Jump to content


Photo

Gmnewton 2.0


  • Please log in to reply
371 replies to this topic

#341 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3278 posts
  • Version:GM8.1

Posted 10 January 2011 - 08:32 PM

use the built-in included files feature of game maker and export the GMNewton.dll to the temp_directory if you really hate looking at it.
  • 0

#342 GmFreaky

GmFreaky

    robson entertaiment

  • New Member
  • 249 posts

Posted 11 January 2011 - 07:45 PM

Hm... having some problems with the convex meshes. It gives me an unexpected error when running the game. Heres the code:

model=create_from_obj('./models/alfaromeo159/alfaromeo159.obj',0,0,1);
texture=background_get_texture(tex_car);

shape   =   GmnCreateConvexHull(global.world,0,0,0,0);
GmnModelBufferLoadMod('models/alfaromeo159/alfaromeo159.d3d',1);
GmnModelBufferClear();
GmnReleaseCollision(global.world,shape);
body    =   GmnCreateBody(global.world,shape);
GmnBodySetAutoMassMatrix(body,1,true);
GmnBodyLinkObject(body,id,true);
z=0;
xrot=0;
yrot=0;
zrot=0;

When using a different shape, it works.
  • 0

#343 GmFreaky

GmFreaky

    robson entertaiment

  • New Member
  • 249 posts

Posted 19 January 2011 - 03:06 PM

Can someone help me with this problem?
  • 0

#344 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 19 January 2011 - 03:20 PM

Can someone help me with this problem?


Sorry- I'm out of town right now for an undefined amount of time. I'll help you when I can!
  • 0

#345 GmFreaky

GmFreaky

    robson entertaiment

  • New Member
  • 249 posts

Posted 26 January 2011 - 11:31 AM

Anyone else can help me with it? :)
  • 0

#346 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 28 January 2011 - 02:02 AM

Hm... having some problems with the convex meshes. It gives me an unexpected error when running the game. Heres the code:


model=create_from_obj('./models/alfaromeo159/alfaromeo159.obj',0,0,1);
texture=background_get_texture(tex_car);

shape   =   GmnCreateConvexHull(global.world,0,0,0,0);
GmnModelBufferLoadMod('models/alfaromeo159/alfaromeo159.d3d',1);
GmnModelBufferClear();
GmnReleaseCollision(global.world,shape);
body    =   GmnCreateBody(global.world,shape);
GmnBodySetAutoMassMatrix(body,1,true);
GmnBodyLinkObject(body,id,true);
z=0;
xrot=0;
yrot=0;
zrot=0;

When using a different shape, it works.


Sorry for my delayed response - I'm still out of town, but have now had an opportunity to look at your code. Although I am unable to test it, I believe that the issue lies in this segment:

GmnReleaseCollision(global.world,shape);
body
= GmnCreateBody(global.world,shape);


If you just swap those two lines, so that the shape is assigned to the body before it is released, I believe things will start working for you!
If this does not solve the issue, please let me know and I am willing to look at a gmk or whatnot to help you further.

-hanson
  • 0

#347 rogerin0

rogerin0

    GMC Member

  • New Member
  • 43 posts

Posted 11 April 2011 - 01:54 PM

Hi Hanson,

When doubling the timestep in GmnUpdate(), the physics acts twice as fast, as though it was fast-forwarded. This can be fixed by simply halving the gravity using GmnSetGravity(), right? And if you don't specify the gravity using GmnSetGravity(), what will be the default gravity value?


Thanks!
  • 0

#348 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 15 April 2011 - 03:13 AM

The timestep passed to GmnUpdate is how much time the simulation should be processed forward. The smaller the time step the more precise the physics will be, but it will have to be called more times to keep it synched with realtime. Halving the gravity would work, but you would also probably want to halve any other forces you were applying. The default for the gravity is:

-9.8 * 16


I can't recall at the moment why I *16 - maybe I was developing with the idea that 16 gm units = 1m. I might change that to default correctly to -9.8 next update, which is in process.
  • 0

#349 _191717

_191717

    GMC Member

  • New Member
  • 60 posts
  • Version:GM8

Posted 15 April 2011 - 06:20 AM

Wow thanks for this dll! Gonna study more.. all i can do for now is falling boxes. :)
  • 0

#350 Boreal

Boreal

    C++ Wackjob

  • GMC Member
  • 417 posts
  • Version:None

Posted 25 April 2011 - 12:03 AM

I can't get anything to move.

I'm basically copying the code from the example (with an FPS perspective, however), but I can't get anything to move. Here is my setup code:
GmnInit();

globalvar world;
world = GmnCreate();
//GmnSetWorldSize(world,-640,-640,-640,640,640,640);
GmnSetGravity(0,0,-9.8);

instance_create(0,0,obj_player);
instance_create(0,0,obj_floor);
And my body-creating code is basically the same as in the example.

I'm using GM8.1.
  • 0

#351 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 25 April 2011 - 02:58 AM

Because the upgrade to GM 8.1 is incompatible with the version of GMAPI that GMNewton is currently using, the auto-update functions are broken when in use with GM 8.1. You can either use GM 8 or lower, wait until GMNewton is updated, or use the following(or something similar) in the step event of each object you want to update, and disable auto-updating:

x=GmnBodyGetPosition(body,0);
y=GmnBodyGetPosition(body,1);
z=GmnBodyGetPosition(body,2);

xrot=GmnBodyGetRotation(body,0);
yrot=GmnBodyGetRotation(body,1);
zrot=GmnBodyGetRotation(body,2);


The auto-updating was the fastest, but this should work until the compatibility issue is resolved.

Sorry for the inconvenience!

-hanson
  • 0

#352 Boreal

Boreal

    C++ Wackjob

  • GMC Member
  • 417 posts
  • Version:None

Posted 25 April 2011 - 03:38 AM

Because the upgrade to GM 8.1 is incompatible with the version of GMAPI that GMNewton is currently using, the auto-update functions are broken when in use with GM 8.1. You can either use GM 8 or lower, wait until GMNewton is updated, or use the following(or something similar) in the step event of each object you want to update, and disable auto-updating:

<snip code>


The auto-updating was the fastest, but this should work until the compatibility issue is resolved.

Sorry for the inconvenience!

-hanson

Ah, thanks.
  • 0

#353 Boreal

Boreal

    C++ Wackjob

  • GMC Member
  • 417 posts
  • Version:None

Posted 03 May 2011 - 01:20 AM

This has to be a legal bump...

I'm making an FPS with this, and I have everything except good movement. I'm using GmnBodyAddImpulse() to add in the direction of the camera and 90 degrees off (forward-backward, strafe). I have friction between the player and the other stuff to slow me down as well. The problem is that sometimes the player walks slightly off from the camera direction (and perpendicular to it), like he's lagging in turning.

Will using a CustomPlayerController help? I've not got one to work before...
  • 0

#354 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 11 May 2011 - 02:49 PM

This has to be a legal bump...

I'm making an FPS with this, and I have everything except good movement. I'm using GmnBodyAddImpulse() to add in the direction of the camera and 90 degrees off (forward-backward, strafe). I have friction between the player and the other stuff to slow me down as well. The problem is that sometimes the player walks slightly off from the camera direction (and perpendicular to it), like he's lagging in turning.

Will using a CustomPlayerController help? I've not got one to work before...


The CustomPlayerController might help with that, or using GmnBodySetVelocity instead of the impulses.
  • 0

#355 BenRK

BenRK

    Now in high-definition!

  • GMC Member
  • 717 posts
  • Version:GM:Studio

Posted 26 May 2011 - 03:47 AM

Any idea if it's possible to port this to GM4Mac?
  • 0

#356 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 26 May 2011 - 03:58 AM

I don't know how, though I'm sure it is possible. Since I haven't had time to keep up with it, I might release the source if anyone is interested in contributing. Also if someone wanted to port it to GM4Mac, I do know it's possible. One would need to download the code from Newton Game Dynamics and compile it on a Mac I think. Anyone up to the task of porting GMNewton and/or helping to improve it?
  • 0

#357 BenRK

BenRK

    Now in high-definition!

  • GMC Member
  • 717 posts
  • Version:GM:Studio

Posted 26 May 2011 - 04:46 AM

I would if I knew how. If someone does, I'll be very happy as it will help with cross platform 3D games and such.
  • 0

#358 CoolGamrSms

CoolGamrSms

    Scorching Strings Maker

  • GMC Member
  • 1499 posts

Posted 03 July 2011 - 12:22 AM

I feel like a total noob, but how do you even use this? I can't find any documentation on any of this. The example is not all that helpful...
  • 0

#359 ihato

ihato

    Destroyed

  • Banned Users
  • 739 posts
  • Version:GM8

Posted 24 July 2011 - 11:30 PM

Are theese scripts realy necessary?
gmi_update_body
gmi_set_script_transform_body
gmi_init

I feel like gmi_init is important, but is this part also important?

nf("set_script_transform_body",1);
gmi_set_script_transform_body(gmi_update_body);



#360 orange451

orange451

    GMC Member

  • GMC Member
  • 984 posts
  • Version:GM8

Posted 02 August 2011 - 06:18 AM

Does this work with Gm 8.1?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users