Outerra forum

Anteworld - Outerra Game => Modding: Importer, Tools & Utilities => JavaScript development => Topic started by: SteelRat on May 12, 2015, 02:57:32 pm

Title: Methods
Post by: SteelRat on May 12, 2015, 02:57:32 pm
Hi Cameni!

Code: [Select]
/*
file: hero.js
*/

"use strict";

$include("scripts/config.js");
$include("scripts/functions.js");

function initialize(reload)
{
this.set_character_model("outerra/mercenary/mercenary");

addWeapon(this, "AK_74M");
}

...

Code: [Select]
/*
file: functions.js
*/

function addWeapon(unit, weapon) {

var cfgWpn = cfgWeapons[weapon];

if (cfgWpn.scope) {
var cfgWpnBase = cfgWeapons[cfgWpn.base];

unit.set_weapon_model(cfgWpnBase.pack); // model is created
var wpn = unit.get_geomob(1);

for (var meshIdx in cfgWpnBase.meshes) {
if (cfgWpn.meshes.indexOf(cfgWpnBase.meshes[meshIdx]) < 0) {
// operations on arrays are correct
try {
wpn.set_mesh_visible(cfgWpnBase.meshes[meshIdx], false); // Error
} catch(e) {
unit.log_err("PTM: set_mesh_visible: " + e);
}
}
}
}
}

Code: [Select]
ERROR: PTM: set_mesh_visible: TypeError: Cannot call method 'set_mesh_visible' of null
ERROR: PTM: set_mesh_visible: TypeError: Cannot call method 'set_mesh_visible' of null
ERROR: PTM: set_mesh_visible: TypeError: Cannot call method 'set_mesh_visible' of null
...

What am I doing wrong?

And yet, it's correctly?
Code: [Select]
var wpn = unit.set_weapon_model(cfgWpnBase.pack);
Title: Re: Methods
Post by: PytonPago on May 12, 2015, 03:13:29 pm
Now when i look at the functions.js ... if ya want to hide a mesh, you have to define its id´s -- (  this.illumfp002_id = this.geom.get_mesh_id('002'); ) ... not sure, but id say you just try to hide them based on the meshes names itself, but it probably needs the "_id" (all the meshes ID´s defined) part on the end and then --- ( this.geom.set_mesh_visible_id(this.illumfp002_id, false); ) ...
Title: Re: Methods
Post by: SteelRat on May 12, 2015, 03:22:44 pm
Now when i look at the functions.js ... if ya want to hide a mesh, you have to define its id´s -- (  this.illumfp002_id = this.geom.get_mesh_id('002'); ) ... not sure, but id say you just try to hide them based on the meshes names itself, but it probably needs the "_id" (all the meshes ID´s defined) part on the end and then --- ( this.geom.set_mesh_visible_id(this.illumfp002_id, false); ) ...

Тут проблема другого характера, в созданном объекте "wpn" отсутствует метод "set_mesh_visible()".
Title: Re: Methods
Post by: SteelRat on May 13, 2015, 04:36:48 pm
The problem is solved.
And the result of me not impressed (
The result has killed my idea!
Title: Re: Methods
Post by: PytonPago on May 13, 2015, 05:04:53 pm
The problem is solved.
And the result of me not impressed (
The result has killed my idea!

 ... why ? ( could you share the files ? )
Title: Re: Methods
Post by: SteelRat on May 13, 2015, 05:31:48 pm
The problem is solved.
And the result of me not impressed (
The result has killed my idea!

 ... why ? ( could you share the files ? )

One more thing that should be checked, then share.
Title: Re: Methods
Post by: SteelRat on June 28, 2015, 10:37:11 am
Hi cameni!

Code: [Select]
var $sketch = this.$query_interface("ot::js::sketch.get");

this.grp = $sketch.create_group();

// These two methods I understand
this.img = $sketch.load_image("ui/basic.imgset/airspeed");
this.img2 = $sketch.load_image2("ui/airspeed.dds");

$sketch.make_group_active(this.grp);
$sketch.attach_to_element(this.geom.get_inst_id(), true);
$sketch.set_xray_mode(true);

this.canvas = $sketch.create_canvas(this.grp, {x:-1,y:1,z:1});

// I do not understand the meaning of having two methods of implementing the same result
$sketch.draw_image(this.img, {x:0,y:0}, {x:60,y:60}, 0xffffffff);
$sketch.draw_image2(this.img2, {x:0,y:0}, {x:60,y:60}, 0xffffffff);
Title: Re: Methods
Post by: cameni on June 28, 2015, 01:42:16 pm
// I do not understand the meaning of having two methods of implementing the same result
$sketch.draw_image(this.img, {x:0,y:0}, {x:60,y:60}, 0xffffffff);
$sketch.draw_image2(this.img2, {x:0,y:0}, {x:60,y:60}, 0xffffffff);

Me neither :D

For some reason Angrypig mixed two interface versions into one. Expect it to change soon.
Title: Re: Methods
Post by: SteelRat on June 29, 2015, 07:03:55 am
I understood  :)
thanks
Title: Re: Methods
Post by: SteelRat on July 01, 2015, 12:43:12 pm
Hi cameni!

Code: [Select]
function update_frame(dt, engine, brake, steering)
{
...

var speed = Math.round(this.speed()*3.6);
var txt = "" + "Speed: " + speed;
this.sketch.make_group_active(this.grp);
this.sketch.draw_text({x:0,y:0}, 0xffffffff, txt);
}

The result on the screen
Speed: (white squares instead of numbers)

Tried so, the result is the same.
Code: [Select]
var speed = this.speed().toString();
How to?

And the associated question of how to format text?
Title: Re: Methods
Post by: angrypig on July 02, 2015, 02:30:11 am
Hi,

the sketch API is not finished yet we are constantly adding new features and modding existing functions. Once we will have it ready we will release documentation for it. Probably in next update...
Title: Re: Methods
Post by: SteelRat on July 02, 2015, 10:19:31 am
Hi,

the sketch API is not finished yet we are constantly adding new features and modding existing functions. Once we will have it ready we will release documentation for it. Probably in next update...

I can not understand where the catch.
If I passed to this argument

Code: [Select]
var txt = "" + "Speed 2: " + (1 + 2 + 3 + 4 + 5.6789);

That data is displayed correctly.
Title: Re: Methods
Post by: SteelRat on July 02, 2015, 01:38:05 pm
 :facepalm: :)

The correct version

Code: [Select]
function update_frame(dt, engine, brake, steering)
{
...

if (this.canvas != undefined)
this.sketch.delete_canvas(this.canvas);

this.canvas = this.sketch.create_canvas(this.grp, {x:0,y:2,z:0});

var speed = Math.round(this.speed()*3.6);
var txt = "";
txt += "Speed: " + speed + "\n";
this.sketch.draw_text({x:0,y:0}, 0xffffffff, txt);
}

Dear developers, do not forget about the method
Code: [Select]
this.sketch.clear_canvas(this.canvas);
Title: Re: Methods
Post by: SteelRat on July 11, 2015, 02:21:55 pm
Hi cameni!

Code: [Select]
// Ground vehicle

function init_chassis(){
...

this.add_weapon(); // arguments?
}
Title: Re: Methods
Post by: cameni on July 12, 2015, 01:13:32 am
It's a placeholder function, does nothing yet.
Title: Re: Methods
Post by: SteelRat on July 12, 2015, 10:43:33 am
It's a placeholder function, does nothing yet.

I'm understood, thank you.
Title: Re: Methods
Post by: SteelRat on November 12, 2015, 07:09:01 pm
Hi cameni!

Code: [Select]
this.geom = this.get_geomob(0);
var bone = this.geom.get_joint("bone_1");
var angle = Math.random()*3.14;
this.geom.rotate_joint_orig(bone, angle, {x:0,y:1,z:0});

var boneAngle = // How get rotate joint "bone"?
Title: Re: Methods
Post by: SteelRat on November 12, 2015, 07:24:27 pm
PS
Will update this page?
http://xtrac.outerraworld.com/wiki/geomob

Code: [Select]
getOwnPropertyNames: geomob(0)

get_pos,
get_rot,
get_inst_id,
get_pos_offset,
get_scale,
set_scale,
set_pos,
move,
set_rot,
add_rot,
remove_from_scene,
get_obb_offset,
get_obb_hvec,
get_eid,
set_custom_data,
get_custom_data,
get_joint,
get_mesh_id,
set_joint_visible,
reset_joint,
rotate_joint,
rotate_joint_orig,
move_joint,
move_joint_orig,
set_mesh_visible,
set_mesh_visible_id,
get_joint_model_pos,
get_joint_local_pos,
deselect,
load_animation,
set_animate_mode,
animate,
set_skeleton_weight,
get_animation_stack,
set_visible,
set_visible_on_slave,
is_visible,
is_ready,
get_bone_model_tm,
get_bone_local_tm,
get_bone_bind_pose_tm,
get_meshes,
get_lods,
get_collision_meshes,
get_mesh_flags,
attach_to,
get_world_transform,
dump_geom_info,
$query_interface,
$rebind_events,
$ctx
Title: Re: Methods
Post by: SteelRat on November 13, 2015, 01:09:02 pm
Hi cameni!

Code: [Select]
this.geom = this.get_geomob(0);
var bone = this.geom.get_joint("bone_1");
var angle = Math.random()*3.14;
this.geom.rotate_joint_orig(bone, angle, {x:0,y:1,z:0});

var boneAngle = // How get rotate joint "bone"?

Code: [Select]
this.geom = this.get_geomob(0);
var bone = this.geom.get_joint("bone_1");
this.geom.rotate_joint_orig(bone, Math.random()*3.14, {x:0,y:1,z:0});

...

var bone_$ret = this.geom.get_bone_local_tm(bone).$ret;
this.log_inf("get_bone_local_tm: $ret: " + JSON.stringify(bone_$ret));
// get_bone_local_tm: $ret: true

var bone_pos = this.geom.get_bone_local_tm(bone).pos;
this.log_inf("get_bone_local_tm: pos: " + JSON.stringify(bone_pos));
// get_bone_local_tm: pos: {"x":0.04446744918823242,"y":0.3633822202682495,"z":1.1257092952728271}

var bone_rot = this.geom.get_bone_local_tm(bone).rot;
this.log_inf("get_bone_local_tm: rot: " + JSON.stringify(bone_rot));
// get_bone_local_tm: rot: {"x":0,"y":0.585388720035553,"z":0,"w":-0.8107527494430542}

PS
RU
Грустно всё это  :(
Возвращаемый методом результат статичен, не учитываются внесённые изменения позиции и углов поворота кости.
Title: Re: Methods
Post by: SteelRat on December 31, 2015, 09:57:49 am
Hi cameni!

Code: [Select]
var mtm = this.geom.get_bone_model_tm(this.point_gun_l_fire);
var firePos = mtm.pos;
var fireDir = // how to convert mtm.rot -> float3 dir - model-space direction of firing;
this.fire(firePos, fireDir, 800, 0.23, {x:1,y:.8});
Title: Re: Methods
Post by: cameni on December 31, 2015, 02:28:35 pm
rot is a quaternion, and if you want the direction of +y axis (the forward axis in model space), then you'd multiply rot * float3(0,1,0), which can be simplified in JS to:

Code: [Select]
fireDir = {
x: 2 * (rot.x*rot.y - rot.w*rot.z),
y: 1 - 2*(rot.x*rot.x + rot.z*rot.z),
z: 2 * (rot.y*rot.z + rot.w*rot.x)}
Title: Re: Methods
Post by: SteelRat on December 31, 2015, 03:29:38 pm
Thank you!
Title: Re: Methods
Post by: SteelRat on January 09, 2016, 07:10:22 pm
Hi cameni!

Code: [Select]
this.get_wheel_param();
this.set_wheel_param();

arguments?
Title: Re: Methods
Post by: cameni on January 10, 2016, 03:04:52 am
Code: [Select]
    //@param wheel wheel id
    //@param name one of suspension_max, suspension_min, suspension_stiffness, damping_compression, damping_relaxation, slip, slip_lateral_coef
    //@return wheel param value
    float get_wheel_param( int wheel, stringtoken name ) const;

    //@param wheel wheel id, -1 all wheels, -2 first two wheels
    //@param name one of suspension_max, suspension_min, suspension_stiffness, damping_compression, damping_relaxation, slip, slip_lateral_coef
    //@param value value to set
    void set_wheel_param( int wheel, stringtoken name, float value );
Title: Re: Methods
Post by: SteelRat on January 10, 2016, 09:14:28 am
Code: [Select]
    //@param wheel wheel id
    //@param name one of suspension_max, suspension_min, suspension_stiffness, damping_compression, damping_relaxation, slip, slip_lateral_coef
    //@return wheel param value
    float get_wheel_param( int wheel, stringtoken name ) const;

    //@param wheel wheel id, -1 all wheels, -2 first two wheels
    //@param name one of suspension_max, suspension_min, suspension_stiffness, damping_compression, damping_relaxation, slip, slip_lateral_coef
    //@param value value to set
    void set_wheel_param( int wheel, stringtoken name, float value );

Thanks!

RU
Теперь я понял причину не удачи, ход моей мысли был правильный.
Но я запрашивал параметр radius, мне возвращался NULL. Мне стоило опросить другие параметры).
Но такое положение завело меня в тупик, мне нужно управлять параметром radius, что бы решить эту задачу.

https://youtu.be/afP5KML9zD0

PS
I have an idea! How to solve.
Title: Re: Methods
Post by: HiFlyer on January 10, 2016, 09:58:17 am
I saw a problem similar to this when looking at some stuff about Bullet boat physics. It had a suggestion about invisible attachments that had specific weight and gravity parameters to keep an object at a predetermined angle..... (not sure if that helps)
Title: Re: Methods
Post by: SteelRat on January 10, 2016, 11:13:57 am
I saw a problem similar to this when looking at some stuff about Bullet boat physics. It had a suggestion about invisible attachments that had specific weight and gravity parameters to keep an object at a predetermined angle..... (not sure if that helps)

Like today operates a ground vehicle simulations. That is, the wheel itself should not be a mesh.
Title: Re: Methods
Post by: SteelRat on January 10, 2016, 11:18:59 am
Quote
PS
I have an idea! How to solve.

RU
Моя идея оказалась верной, но принесла с собой другую проблему.
Я понимаю что можно создать дубли сеток колёс, и в зависимости от состояния шасси скрывать одни и показывать другие.
Но по мне такая реализация выглядит как костыли(medical term), и мне совсем не нравятся подобные реализации.

https://youtu.be/IwzrpiBwyj8
Title: Re: Methods
Post by: SteelRat on January 10, 2016, 02:57:54 pm
Hi cameni!

Code: [Select]
this.geom.attach_to()
arguments?
Title: Re: Methods
Post by: cameni on January 11, 2016, 09:54:46 am
Another geom object and a bone id to attach to.
Title: Re: Methods
Post by: SteelRat on January 11, 2016, 10:19:13 am
Another geom object and a bone id to attach to.
Thanks!

PS
detach?

PS_2
You can use the method attach_to() to the geometry of the different objects?

https://youtu.be/EdV3Adw6FMc

Last created box disappears.
If you apply
Code: [Select]
var pos = this.geom.get_pos();
var rot = this.geom.get_rot();
var dist = 6;
var box;
var dirs = [0, 45, 90, 135, 180, 225, 270, 315];
for (var i = 0; i < dirs.length; i++) {
box = $world.create_instance("PytonPago/AmmoBox_Wood_23x152mm_63pc/AmmoBox_Wood_23x152mm_63pc_BZT", relative_pos(pos, rot, dist, dirs[i]), rot, false);
}
box.geom = box.get_geomob(0);
box.geom.attach_to(this.geom, this.TurVal);
Title: Re: Methods
Post by: SteelRat on January 12, 2016, 03:48:47 pm
Hi cameni!

I already broke my forehead!)
Can it is necessary for more than two arguments?

https://youtu.be/2YC8Ca2c_1Q

Title: Re: Methods
Post by: angrypig on January 13, 2016, 03:47:49 am
If you send us FBX files for both models I could look into it.
Title: Re: Methods
Post by: SteelRat on January 13, 2016, 08:02:21 am
If you send us FBX files for both models I could look into it.

These models are created PytonPago, I asked him to send you the source models.
Ural-4320-31_6x6_CHASIS
AmmoBox_Wood_23x152mm_63pc

ZS-23-2
https://onedrive.live.com/redir?resid=BA7B7E2655BF556D!6930&authkey=!ALpuEGhfxsU0JwI&ithint=file%2czip
Title: Re: Methods
Post by: SteelRat on January 13, 2016, 12:20:52 pm
What I have done here is not so! I do not understand!)

https://youtu.be/AZJx-V7EftY
Title: Re: Methods
Post by: PytonPago on January 16, 2016, 03:47:09 pm
If you send us FBX files for both models I could look into it.

 ... damn, havent seen this topic ... here are the FBXs AngryPig :

https://drive.google.com/file/d/0B3ZscF0ox2AGQVAyQUlFM2tURnc/view?usp=sharing (https://drive.google.com/file/d/0B3ZscF0ox2AGQVAyQUlFM2tURnc/view?usp=sharing)

Title: Re: Methods
Post by: SteelRat on January 25, 2016, 04:09:26 pm
Hi cameni!

Code: [Select]
this.geom.attach_to()
arguments?

I understood the reason for the failures in the application of this method.
Cause I do not think a lot of strange, but do not judge me).

To object to which the method of attach_to() , has taken the correct position relative to the parent, the slave must be created on the same coordinates as the parent object.

https://youtu.be/bNuPS3CHlwM
Title: Re: Methods
Post by: SteelRat on January 26, 2016, 12:19:21 pm
Hi cameni!

RU
Как я могу сделать проверку, управляет юзер объектом или нет?
Мне это нужно для того, что бы блокировать не востребованную логику в функции "update_frame()".

Translate
How can I do a background check, the user operates the object or not?
I need it in order to block that are not in demand in the logic function "update_frame ()".
Title: Re: Methods
Post by: cameni on January 27, 2016, 03:35:02 am
Hmm probably via get_camera_mode(). 0 is FPS mode, 1/2/3 TPS modes, and without user it should be a higher number.
Title: Re: Methods
Post by: SteelRat on January 27, 2016, 08:59:42 am
Thanks!
Title: Re: Methods
Post by: SteelRat on January 27, 2016, 12:46:54 pm
Hmm probably via get_camera_mode(). 0 is FPS mode, 1/2/3 TPS modes, and without user it should be a higher number.

PS
It works great. Thanks again.
Title: Re: Methods
Post by: SteelRat on January 30, 2016, 10:46:15 am
Hi cameni!

What is it?
Code: [Select]
// this.get_inv_mass()

{
"$ret":0.01666666753590107,
"inv_inertia":{
"col":[
{"x":5795.962890625,"y":1.54741370677948,"z":-54203176},
{"x":1.3173075914382935,"y":0.000012145993423473556,"z":1.284999966621399},
{"x":0,"y":0,"z":0}
]
}
}
Title: Re: Methods
Post by: cameni on January 30, 2016, 12:41:57 pm
1/mass and inverse inertia tensor as returned from Bullet physics.
Title: Re: Methods
Post by: SteelRat on January 30, 2016, 05:48:36 pm
1/mass and inverse inertia tensor as returned from Bullet physics.

RU
Со второй частью я ещё не скоро выпью на брудершафт :facepalm: :)
https://en.wikipedia.org/wiki/Tensor

Thanks!
Title: Re: Methods
Post by: SteelRat on February 03, 2016, 09:56:18 am
Hi cameni!

RU:
После применения к созданному объекту метода "attach_to()", на позиции создания объекта остаётся "Коллизия" этого объекта.
Я не придавал этому значения пока не столкнулся со странным(избирательным) поведением "Коллизии".
На данный момент у меня есть возможность решить эту проблему?

Translate:
After applying to the created object method "attach_to()", the position of the object creation remains a "Сollision" of the object.
I did not attach any importance to this until he encountered a strange(electoral) behavior "Collision".
At the moment, I have the opportunity to solve this problem?

https://youtu.be/-HzmW9UOjqY

PS
I do not understand what's going on! :)
http://forum.outerra.com/index.php?topic=3360.msg39958#msg39958
Title: Re: Methods
Post by: PytonPago on February 04, 2016, 02:21:27 am
... i just thought ... could you do he same white the collision meshes visible on both the magazine and the gun ? .... its moving like it would insert the magazies collision mesh box underneath the gun fixet to that position, whyle the gun just jumped on it and then slid off of it during fire ....
Title: Re: Methods
Post by: SteelRat on April 19, 2016, 12:51:25 pm
Hi Cameni!

Code: [Select]
// basic canvas API example

this.cnv = this.$query_interface("ot::js::canvas.create", "main", true);
this.fnt = this.cnv.load_font("ui/default.fnt");
this.cnv.fill_rect(100, 100, 200, 200, 0x80808080);

this.cnv.draw_text(
this.fnt,
100, 100,
200, 200,
0x02 | 0x20,
"Lorem ipsum dolor sit amet, consectetur\n"
+"adipiscing elit. Nam vestibulum enim quis\n"
+"nisi tincidunt rhoncus. In hac habitasse\n"
+"platea dictumst. Vivamus rutrum posuere\n"
+"dui ut scelerisque.",
0xffffffff,
0x00000000); // ERROR: ground_vehicle::update_frame: D:/Program_data/Outerra_data/packages/SteelRat/Test_truck/functions/ptm_fnc.js(149): SyntaxError: Wrong number of arguments

Where is the problem?
Title: Re: Methods
Post by: angrypig on April 19, 2016, 03:01:36 pm
Some of these functions are from new API or testing stuff which is not accessible in public version yet. This new API is using freetype2 library for fonts
Title: Re: Methods
Post by: SteelRat on April 19, 2016, 08:27:45 pm
Some of these functions are from new API or testing stuff which is not accessible in public version yet. This new API is using freetype2 library for fonts

That is, I can not use it?
Title: Re: Methods
Post by: DenisJ on April 20, 2016, 02:04:00 am
It will be fully released in one of the major updates.

Скоро будет доступно и вам.
Title: Re: Methods
Post by: SteelRat on April 20, 2016, 08:53:58 am
Ok. Thanks!
Title: Re: Methods
Post by: SteelRat on April 25, 2016, 12:13:24 pm
Hi Cameni!

I am faced with a situation that does not call it a problem, but!
I create the visual effect of inertia camera in a vehicle.

The code block
Code: [Select]
/// camera
if (this.get_camera_mode() == 0) {
var seatBone = this.player.points[this.player.seatCam].seatBone;

// lateral inertia
var inertiaY = clamp(
interpolate(velocity.angular.y, -Math.PI, Math.PI, -1, 1) + interpolate(velocity.linear.x, -6, 6, -1, 1),
-1, 1
);
this.geom.rotate_joint_orig(seatBone, -.35 * inertiaY, {x:0, y:1, z:0});
//this.geom.rotate_joint_orig(seatBone, -.35 * inertiaY, {y:1}); // so I also tried

// inertia acceleration and braking
var inertiaX = clamp(
interpolate_table(velocity.linear.y * (-brake || engine), [-4, 0, 4], [-.15, 0, .075]),
-.15, .075
);
this.geom.rotate_joint_orig(seatBone, inertiaX, {x:1, y:0, z:0});
//this.geom.rotate_joint_orig(seatBone, inertiaX, {x:1});
}

Running a block of code "inertia acceleration and braking" cancels the changes made by the "lateral inertia" in the code block.
I understand what you can do X and Y their bones, it seems to me not very profitable.

Maybe it makes sense to slightly change the algorithm of the method?
Code: [Select]
var valX = expression;
var valY = expression;
var valZ = expression;

this.geom.rotate_joint_orig(bone, {x:valX, y:valY, z:valZ});

Or so.
Change their values only listed axis.
Code: [Select]
this.geom.rotate_joint_orig(bone, value, {x:1});
Title: Re: Methods
Post by: cameni on April 25, 2016, 02:03:08 pm
rotate_joint_orig means "rotate from original position"
rotate_joint means adding on top of the current rotation.
Title: Re: Methods
Post by: SteelRat on April 25, 2016, 02:12:28 pm
rotate_joint_orig means "rotate from original position"
rotate_joint means adding on top of the current rotation.

I understood. Thank you!
Title: Re: Methods
Post by: SteelRat on June 03, 2016, 01:21:56 pm
Hi cameni!

Code: [Select]
this.geom.get_bone_model_tm_offset(bone_id, arg2);

1) I can not understand that this method returns?
2) What type of argument arg2, and that it determines?
Title: Re: Methods
Post by: cameni on June 03, 2016, 04:27:54 pm
A typical Angrypig's undocumented function :)
But the second argument is "offset", so I assume it's an offset in model space.

It returns an object that contains pos and rot members, rot is a quaternion.
Title: Re: Methods
Post by: SteelRat on June 03, 2016, 08:38:56 pm
A typical Angrypig's undocumented function :)
But the second argument is "offset", so I assume it's an offset in model space.

It returns an object that contains pos and rot members, rot is a quaternion.

Ok. Thanks!
Title: Re: Methods
Post by: SteelRat on June 04, 2016, 09:04:04 pm
:facepalm: :)

The correct version

Code: [Select]
function update_frame(dt, engine, brake, steering)
{
...

if (this.canvas != undefined)
this.sketch.delete_canvas(this.canvas);

this.canvas = this.sketch.create_canvas(this.grp, {x:0,y:2,z:0});

var speed = Math.round(this.speed()*3.6);
var txt = "";
txt += "Speed: " + speed + "\n";
this.sketch.draw_text({x:0,y:0}, 0xffffffff, txt);
}

Dear developers, do not forget about the method
Code: [Select]
this.sketch.clear_canvas(this.canvas);

Wow!!!
Only today said that added :)

Code: [Select]
this.sketch.clear_canvas()
Many thanks! :)
Title: Re: Methods
Post by: SteelRat on July 16, 2016, 04:16:15 pm
Hi Cameni!

Code: [Select]
INFO: get_bone_model_dq:
{
"$ret":true,
"rot":{"x":3.0616174623351647e-17,"y":-5.960463766996327e-8,"z":3.515645981781436e-17,"w":1.0000001192092896},
"dual":{"x":0.050012435764074326,"y":0.6886845231056213,"z":1.227365493774414,"w":4.845940893005718e-8} // <-- What is it?
}
Title: Re: Methods
Post by: cameni on July 17, 2016, 02:18:55 am
http://cs.gmu.edu/~jmlien/teaching/cs451/uploads/Main/dual-quaternion.pdf
Title: Re: Methods
Post by: SteelRat on July 17, 2016, 12:11:33 pm
Thanks!