Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Grant, TipmyPip, AndrewAMD), 12,724 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[Newton] Function question #48298
06/25/05 08:29
06/25/05 08:29
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
My saved levels load fine during the same session but if I close Gamestudio and load the saved game again, Newton doesen't seem to remember that certain entities are physics objects.
Is there a way I can get Newton to write to my saved game file with this function? Can it be done by using NewtonBodySetTransform ? If so, how? Thanks

////////////////////////////////

function load_game()
{
saving_pan.visible = off;
main_panel.visible = off;
pause_panel.visible = off;
freeze_mode = 1;

loading_pan.visible = on;
loading_pan.pos_x = (screen_size.x / 2) - (bmap_Width(loadingmap) / 2);
loading_pan.pos_y = (screen_size.y / 2) - (bmap_Height(loadingmap) / 2);
pause_panel.visible = off;
if(game_load("21save",001)>0)
{
sleep (2);
loading_pan.visible = off;
purge_bmaps();
kill_music();
freeze_mode = 0;
mouse_mode = 0;
set_video_mode(vid_mode);
game_state = 1;
}
else
{
game_state = 0;
main_back();
loading_pan.visible = OFF;
ui_panel.visible = OFF;
}
}

Last edited by Daedelus; 06/25/05 09:00.
Re: [Newton] Function question [Re: Daedelus] #48299
06/25/05 12:15
06/25/05 12:15
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
with NewtonBodySetTransform you can reset the position of a newton entity. usually physics entities get moved by forces. sometimes it's helpful though if you can reset it to any position you want. you can't simply change entity.x/y/z then because the newton engine wouldn't know about that. so you have to use NewtonBodySetTransform.

for integrating newton with the load/save system of the engine i would cycle through the newton entities and save all important properties (velocity, mass,...) before destroying them. after loading you have to create them again and reset the saved properties.

Re: [Newton] Function question [Re: ventilator] #48300
06/25/05 18:36
06/25/05 18:36
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline OP
Senior Developer
Daedelus  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
Thanks Ventilator, so NewtonBodySetTransform is still necessary even if the positions are remembered during game load?


Formula Games - A place to buy and sell Indie games.

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1