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.

Code Snippets / Simple Bouyancy Physics Demo...

Author
Message
DBAlex
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 7th Mar 2005 04:32 Edited at: 7th Mar 2005 04:41
just made this today because I wanted to work out how to do simple bouyancy physics in DB...

Everythings in the .zip...enjoy!

oh and please comment...Its my first code snippet.


>_0

Attachments

Login to view attachments
dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 7th Mar 2005 06:08
It's ok other than the fact that it's a little jumpy and just keeps up and down at a high rate.

It has been said that the body is a slave to the mind. Only the mind knows no freedom.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Mar 2005 03:56
Haven't d/loaded, just wanted to let you know if you want ready-made bouyancy, The Newton wrapper has it built in. Depends on whether you're doing for fun or out of necessity

BatVink
DBAlex
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 8th Mar 2005 19:15
Yeah i new that dude.

Just wanted to see if i could do it myself...

Thanks anyway.


>_0
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Mar 2005 23:17
It's always more rewarding to do it yourself

BatVink
dj blackdragon3710
20
Years of Service
User Offline
Joined: 5th Nov 2004
Location: In LaLa land
Posted: 9th Mar 2005 05:34
Isn't that why were coding our own games and apps.?

It has been said that the body is a slave to the mind. Only the mind knows no freedom.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Mar 2005 04:08 Edited at: 12th Mar 2005 04:23
A few pointers:

You don't need to create camera 1, as you already have camera 0 as default. Only create a second camera when you need two views of something.

You don't need to position the camera every loop if it is not changing. Remember to turn autocam off if you want to change the cameras position.

Use y# (a 'float') rather than y (an integer), as y# can take values like 3.254, but y can only be a whole number.

Try to post code snippets that have no media, like pictures etc. Not many people will bother looking at it if they have to go unzipping files and stuff!

Finally, try using a sine function to make the bobbing movement smoother.








Login to post a reply

Server time is: 2024-11-23 14:14:24
Your offset time is: 2024-11-23 14:14:24