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 / Little snippet using newton physics.

Author
Message
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 27th Jun 2004 09:55
You'll need the latest version of DBP Newton installed and have textures "floor1.bmp" and "balltex.bmp" in the same dir as the dir you save the code to.
Snippet shows movement AI for getting from place to place, only being able to speed up/slow down its omega velocity and linear velocity. The AI travels to targets randomly set.
Snippet also shows how to change the omega velocities like free flight commands, relative to the object and not to the world axises.

-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.
Juso
22
Years of Service
User Offline
Joined: 23rd Sep 2002
Location: Finland
Posted: 1st Jul 2004 01:53
End of your source is missing

Last line is " if dist#"
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 2nd Jul 2004 10:31 Edited at: 2nd Jul 2004 10:36
oh whoops. sorry, ummm, I've added a bit to the code. now it's a snippet with flying cars, like in star wars episode 2, except the flying cars are boxes . There are 3 AI controlled flying cars that chase you like GTA cops, in the first few lines of code there is a variable named COP_AMOUNT, change that if you want more/less/no flying cars chasing you. Since the flying cars can only accelerate/slow down in 3 demensions, the AI was hard to program. All flying cars have a "stabilizer" which keeps the cars from rolling, and thus keeping the cars right side up(but doesn't control the pitch of the car, so you car pitch the car up, go upside down, the stabilizer will turn the car unright, and you can keep on flying) (The players car only tries to stay upright when you aren't pressing the roll buttons(the A and D keys). It would be really cool if there was an actual game made with a gta theme, but with flying cars, and you would have to free fall into a car to steel it . Anyways, here's the code, the full source
Btw you'll need the latest version of DBP Newton installed and have textures "floor1.bmp" and "balltex.bmp" in the same dir as the dir you save the code to.

EDIT:
there must be a forum bug cuz it cut off the code again. I can't edit or delete the attached code, so here it is:



-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.
wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 3rd Jul 2004 19:20
hmm, nice, but i would like see code for car control with newton

PS: Real programmers aren't afraid of math!.

☺☺ AthlonXP 2500+, Ati Radeon 9600 128MB, dualDDR 512MB 400Mhz CL3.0, SB LIVE!, monitor 19" ☺☺

Login to post a reply

Server time is: 2024-11-23 19:38:39
Your offset time is: 2024-11-23 19:38:39