Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: 1 2 3 [4] 5

Author Topic: Methods  (Read 32416 times)

PytonPago

  • Hero Member
  • *****
  • Posts: 2266
  • It´s way too complex, dont let me try to explain !
Re: Methods
« Reply #45 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 ....
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #46 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?
Logged

angrypig

  • Sr. Member
  • ****
  • Posts: 454
Re: Methods
« Reply #47 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
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #48 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?
Logged

DenisJ

  • Full Member
  • ***
  • Posts: 192
  • Кусь
    • VK Community
Re: Methods
« Reply #49 on: April 20, 2016, 02:04:00 am »

It will be fully released in one of the major updates.

Скоро будет доступно и вам.
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #50 on: April 20, 2016, 08:53:58 am »

Ok. Thanks!
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #51 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});
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6700
  • No sense of urgency.
    • outerra.com
Re: Methods
« Reply #52 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.
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #53 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!
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #54 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?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6700
  • No sense of urgency.
    • outerra.com
Re: Methods
« Reply #55 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.
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #56 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!
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #57 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! :)
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: Methods
« Reply #58 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?
}
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6700
  • No sense of urgency.
    • outerra.com
Logged
Pages: 1 2 3 [4] 5