Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Newton Physics -- Switching between methods?

Author
Message
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 30th May 2007 17:49
Im working on a map editor right now, and for the time being, every object is moved / rotated / scaled by using the native dbp object commands. This is fine, I dont want there to be any physics on an object when its being manipulated anyways.

But, when the object is deselected, I do want physics applied (so the object falls / collides when its deselected).

Right now Ive gotten my objects falling and colliding when they're created.

The way I see it there are 2 options (from what Ive been reading), either I

a) Switch to applying global forces to my objects when I want to manipulate them, and set their gravity to 0, when they're selected.

b) Am missing some sort of command that allows you to use the native dbp commands, and then update the newton object to whatever changes you've made to the dbp object (this'd be great).

I dont think I need to show any source code in this case, since its mainly theory / pointing me towards a command.

I have looked into the global force commands, I tried setting my object's y force to 10 when it was chosen to move on the y axis, but nothing happened. Though Im sure thats just due to lack of reading / experimentation.

Any help appreciated, obviously source code examples from the newton guru's would be great,

- RUC'


SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 31st May 2007 19:51 Edited at: 31st May 2007 19:53
part b: possible, but not in one command: there's no command to position all bodies according to where dbp thinks the related objects are, but you can position all of the bodies manually:



This would move the newton bodies to new positions without applying forces (so they won't drift away). of course, I've not actually tested that - but I believe it should work, the bodies may not actually be repositioned until another ndb_newtonupdate statement is hit
Edit: yep clearly not tested -- spelt recursive wrong

but of course, if you don't disable the gravity, they'll fall, and if linked to objects, DBP will be told the objects' new positions and rotations by newton, rendering the above snippet useless as they'll be positioned where they already are.


the other point you made about applying a force (with 'y' of 10) to a body won't always cause the body to move -- it does depend entirely on the mass of the body you apply the force to:
try values of like 100, 1000 or even 10000 -- it may fly away into the air, never to be seen again, but at least it's moving.

If the object hasn't moved when you've reached a y-value of something like 100 billion, perhaps the body has been frozen by newton


Sorry I can't really provide any more info on this - perhaps some people with more experience with newton will know...

Login to post a reply

Server time is: 2024-11-25 18:04:52
Your offset time is: 2024-11-25 18:04:52