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.

Program Announcements / Newton Game Dynamics WRAPPER v1.32

Author
Message
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 2nd Oct 2005 02:11
Thought I already posted this. Guess not. Anyway, the physics system appears to break down at distances greater than ~280,000. Accelerate a physics object past that and you should see what I mean. It kinda acts like it can no longer correctly calculate where to place the acceleration.

Cheese!

Expert Bug-Finder, Horrible at Identifying Them.
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 2nd Oct 2005 17:37
walaber,
i noticed in your game Shichinin No Himesama 七人の姫様, you calculate the dot product. i never relalised what it was for, but this post of yours made me understand i will have a deeper look at your game and try to learn as much as i can from it
btw, in your website i must write walaber.com/index.php to access it. if i dont write the index.php thing then i get an error, the file main.htm was not found.

Narf The Mouse,
i know exactly what you mean, when i had some ragdolls in an old test, and i fired with the shotgun the ragdoll got accelerated so fast on the spot it was hitted so it began to spin and that really slowed down the game. so now im using a weaker effect on the shotgun
this also happens when a ragdoll falls from too high i have noticed.

walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 2nd Oct 2005 18:41
website works fine here.. try refreshing your browser so it doesn't look for the old files.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 2nd Oct 2005 20:37 Edited at: 2nd Oct 2005 20:38
hello, yes you are right about that

i dont understand this: (from that game of yours)
dx# = Char_GetKeyFloat( name$, CF, CHAR_KEYDX )
dz# = Char_GetKeyFloat( name$, CF, CHAR_KEYDZ )

what is it actually returning?
i know it returns the value of a memblock float but exactly which value im not sure

Quote: "then finding the angle between the "X" vector, and some known vector (like 1,0,0)."

is that "known vector" the dx# in your code?


im not sure i quite follow you..

so you are saying i need to find the x angle on my body:
Quote: " NDB_NewtonBodyGetMatrix zBody
matrixX# = NDB_GetVector_X(1)
matrixY# = NDB_GetVector_Y(1)
matrixZ# = NDB_GetVector_Z(1)"


next i need to find the angle between matrixX# and "some known vector (like 1,0,0)". and i can get the angle by calculating the "dot product". hmm....

according to your code, you do it like this
Quote: " dx# = Char_GetKeyFloat( name$, CF, CHAR_KEYDX )
dz# = Char_GetKeyFloat( name$, CF, CHAR_KEYDZ )

NDB_NewtonBodyGetMatrix body
NDB_GetMatrix

cx# = NDB_GetVector_X(1)
cz# = NDB_GetVector_Z(1)

dotp# = (cx#*dx#) + (cz#*dz#) :`dot product"


but what is dx# ? is that the "known vector"?

(sorry if im such a burden but i want to learn this )

walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 2nd Oct 2005 22:12
yes. in my code, DX and DY are the direction I want the enemy to face.
basically I check the angle between the desired direction, and the current direction, and apply either a positive or negative torque based on the results.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 2nd Oct 2005 22:38 Edited at: 2nd Oct 2005 23:01
aha. i understand now

dx = destination x
cx = current x

i never thought of that before.

this will be easy. (i hope )


edit,

wait is the dx and dz the destination x/y-angle or position??

i have now got this code in my game:


did i do it correctly? obviously not, since the zombie is just spinning around and when it get too close to the wall i get an error message saying Rigidbody 2048 does not exist.

i rotate the visual object to the desired angle first.
then i move it forward to get the dx and dz position values.
then i rotate it back to normal, and move it back to where it was.
then i do what you told me.

something is wrong though.. maybe its because im tired... but if you have time please look at the code and tell me what i do wrong.

Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 2nd Oct 2005 23:11
Narf the Mouse - The problem is purely down to the inaccuracy to floating point variables, since they can only really manage up to ~7 digits of accuracy. So when a body is positioned at 280,000 the accuracy only goes to about the nearest 0.1, so there's no wonder the thing's having problems!

Don't look at me like that!
You're just jealous because the voices are talking to me!
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 2nd Oct 2005 23:36
DX and DZ are the X and Z components of a vector pointing in the direction we want to face. CX and CZ are and X and Z component of a vector pointing in the direction that we're currently facing.

in both cases we can ignore Y, because we assume we're moving on a flat plane, so all vectors will have a Y component of zero.

if you want to get the DX and DZ manually, do this: rotate the object facing the way you want, and do this:


this gives you DX and DZ as component of a "unit vector" pointing in the direction you want to go.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 3rd Oct 2005 10:40 Edited at: 3rd Oct 2005 10:45
Avan: That doesn't make sense. The acceleration position is relative to the newton body, so it doesn't have to deal with the large number when accelerating.

However, upon re-viewing, it does seem to fit.

Any way to fix this? I want a scale model of the solar system to fly around in.

Cheese!

Expert Bug-Finder, Horrible at Identifying Them.
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 3rd Oct 2005 12:48
thanks walaber. i think i have the information i needed.
thanks alot for your help and hopefully i will get it to work tonight. (hopefully i will have time to work on this).

Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 4th Oct 2005 13:14 Edited at: 4th Oct 2005 13:19
ok, let me see if i got this:

first of all i find the angle i want to rotate to


and i get the CX and CZ of the current angle


then i need to find the DX and DZ of that angle


next i must get the find the dotproduct of DX, DZ, CX and CZ


now if the dotproduct < 0.0 then rotate left, if > 0.0 then rotate right, if = 0.0 then dont rotate



if this information is correct, then it should rotate like i expect it to.
but it don't

what happens is the zombie is just spinning around and teleportating all over the room.

walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 4th Oct 2005 17:30 Edited at: 4th Oct 2005 17:31
other than that you have SetTorque twice, it looks alright. remember that my code was specialized for my objects, which had a specific mass. if you're not seeing any motion, or not enough motion, you might want to try adjusting the scalars in there when calculating the torque. also I have never used the yrotate object command, so I'm uncertain of its bevahior.

also this code assumes your object is "facing" in the positive X direction (in your modeller). if not, you might end up with a character walking sideways.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 4th Oct 2005 18:55 Edited at: 4th Oct 2005 18:58
yrotate object will rotate the "visual" object to a desired angle. [edit]it rotates by the rules 0..90..180..270 and not 0..90..-0..-90.[/edit]

i got it to work (almost)
i changed the go# variable to something smaller (0.5) and it rotates like i want it to. (used to be 10.0)

and by almost i mean that the object, or body, rotates exactly how i want, but still it cannot pass the 0-180 degrees thingy. (actually it is -90 to +90)

it gets to -89.xxxx and stop rotating or it gets to 89.xxx and stops there. [edit]so it can rotate by these angles: -90..0..90 (270..0..90)[/edit]

any more tips? have this something to do with how i setup that objects rigid body? in that case, check out the
. if not then don't look at the code snippet. (as i said, my game will be open source so if i release some source that doesn't matter)

thanks for the help so far i feel so embarrased asking so many questions

Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 5th Oct 2005 00:40
Narf the mouse- The entire solar system? Ehem, I have to admit I wouldn't use a 'game physics library' to do that, I'd be more likely to invest in a physics library that's aimed at the space simulation market, and I couldn't say where you'd find that. At the very least you'd be wanting 64bit variables for the positioning and most physics libraries, such as Newton, ODE and Havok, almost certainly stick with 32bit variables because they're faster to process then 64bit and they're plenty accuracy enough for the vast majority of games.

However, there are ways that you can 'trick' the physics. A good example is the GTA games, in those they only process the physics for vehicles near to where you are. The idea is, if it's a mile away, why process it?

I do have a question, are you just trying to make a solar system simulator, or are you making a game with ships, like an RTS like Homeworld or a combat game like Elite or Freelancer?

If you're after a soar system simulator to be honest I doubt Newton would be up to the job, simply because you'd need to keeptrack is tiny objects at very high accuracy positions with huge distances and 32bit variables just can't do that.

If you'r after a space combat or RTS game I'd suggest going with the idea of only having the physics process things within a certain distance of the player or within a set map size. The planet movement could be easily patched on without the need for complicated physics calculations. Infact you could quite easily get away with just moving the planets around the sun in a perfectly circular motion. Heck, who'd notice it other then an astronomer, and what kind of an astronomer would spend their time analysing the movements of planets in a game?

Don't look at me like that!
You're just jealous because the voices are talking to me!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 7th Oct 2005 12:29
Just dropping in some kudos for Walaber and Kjelle - been learning Newton over the last month and the work you two have put in is awesome and very much appreciated, thanks guys.


Van-B

Put those fiery biscuits away!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 7th Oct 2005 17:02
I am having some compatability problems with Newton and U5.9. Some of the collision data for the objects is wrong. Mike said some dlls may need to be recompiled with the new GlobStruct library for them to work in 5.9.

Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 7th Oct 2005 18:28
Hamish,
i've heard Black Out is using Newton.
do you get any problems when rotating your AI enemies?
when i try, they can only rotate 180 degrees. they cant make a full 360 spin... do you have any tips? do you have anything currently written in the source?

Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 8th Oct 2005 17:12
Lukas - No, I don't have any AI enemies, and I don't control the character rotation using Newton, only the position. Rotation is controlled by my own code. Newton is a physics engine, not a game engine. Your AI characters aren't specifically controlled by Newton, it must be a bug in your code. The source for blackout is freely available (updated a few days ago) in the thread if you want to have a look at the code .

Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 8th Oct 2005 20:44 Edited at: 8th Oct 2005 20:55
yes please. i will see if i can find the source. thanks

edit,
it looks like you are using EZrotate, right?
aww.. i will see what i can learn from that anyway...

edit,
there is one newton command i have never seen before that you are using: NDB_NewtonBodySetLinearDamping.
i have no clue what it i for, the help file says something about torque, so i guess it has something to do with rotations.. i will try it out as soon as i get to the computer with my game on

Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 10th Oct 2005 21:23 Edited at: 10th Oct 2005 21:24
@Avan: Thanks. Not a game or a precise simulator; just quite literally, something to fly around in. As for the seven-figure limit, I guess I'll just have to make kilometer-long ships.

So...I'd move the planets and stuff relative to the ship, and then only engage newton once they were within, say, 90,000?

[Dubious]I don't suppose any of those space simulator packs have been wrapped for DBPro?[/Dubious]

Probably would have to pay for them anyway, and for a little toy like this, it wouldn't be worth it.

Cheese!

Expert Bug-Finder, Horrible at Identifying Them.
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 11th Oct 2005 19:33
Linear damping sets the rate at which the object's velocity decreases over time. Angular damping is the rate at which the object's rotational velocity decreases over time.

Kjelle - Could you possibly make it so that you can set the gravity value for individual bodies? At the moment you can either have on or off, but not different values.

BealziBob
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: The Grim North (UK)
Posted: 11th Oct 2005 19:50
Mr. Kjelle sir,..... is there any chance of testing & recompiling Newton for DBPro 5.9 as i've heard there are a few problems.

Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 12th Oct 2005 20:32 Edited at: 12th Oct 2005 20:34
Yes as soon as the final ver. of DBPro 5.9 is out, I will start to test the wrapper compatibility.

What kind of problems are listed so far?

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
BealziBob
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: The Grim North (UK)
Posted: 14th Oct 2005 16:36
Honestly not sure Kjelle69 as i refuse to install 5.9 until the final patch has been out for a few weeks. I was only concerned as I saw these two posts in the Beta2 bug report sticky.

Quote: "One thing to remember - some 3rd party DLLs that rely on the GlobStruct or the DBO format may need to be recompiled. "

Quote: "Could this be what is causing the collision data in the Newton plugin to become corrupt for some objects in 5.9?"


Really I just wanted to know if you are going to keep working on Newton, as I have no interest in learning about ODE or the new physics addon while newton does the job perfectly well.

Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 15th Oct 2005 22:59
I was the one who quoted the latter. When using U5.9 beta 2, the Newton collision trees seemed to disappear. All the other bodies seemed to respond properly. I reinstalled 5.8 and it worked perfectly again.

Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 17th Oct 2005 22:02
I switched from loading up the objects and running this:

To using the rbd loader.dba found in the Newton Demo06 found in the '\NDBv_132 Release\demos' folder.

Now my program starts up a lot faster, but it randomly freezes. The more objects I put in, the more likely it is to freeze. It also occasionally crashes while loading objects, but as it used to crash a lot more, I'm less worried about that.

I've got 200 objects now; looking to get 400 in.


Cheese!

Expert Bug-Finder, Horrible at Identifying Them.
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 18th Oct 2005 09:49
walaber or kjelle,

remember i had (yes had) problems with rotating my enemies?

well, the thing is i went back to "teleport rotation"
when using "smooth rotation" my objects can only rotate 180 degrees. not more, not less. when using "teleport rotation" my objects rotate like they should, only they suddenly faces another direction and it looks really ugly but yeah, i will go with this for now, unless someone have an explanation (or code!).

awesome wrapper by the way. my next step will be ragdolls.

("oh noo" i hear you scream, ah well)

AndyBth
19
Years of Service
User Offline
Joined: 18th Oct 2005
Location: Sweden
Posted: 21st Oct 2005 13:11
Hi is there any possibility this will be available for the Dark Game SDK?
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 21st Oct 2005 19:37
Kjelle - Freddix has posted the globstruct.h file for the final U5.9. If you could recompile the plugin with this globstruct then I'm sure it would be a great help to everyone who relies on Newton in their projects (ie. we can install 5.9!).

http://forum.thegamecreators.com/?m=forum_view&t=63266&b=18

MiR
21
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 21st Oct 2005 19:46
Quote: " Hi is there any possibility this will be available for the Dark Game SDK?"

It already is. Newton works natively in the DGDK. This is a wrapper so it can work in DBPro.

My signature has been erased by me because it's LARGE.
Thank you for the votez!1!
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 22nd Oct 2005 03:23
I will take a look and see if it is possible to get the Wrapper to work with 5.9 as soon as the final ver is out.

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
AndyBth
19
Years of Service
User Offline
Joined: 18th Oct 2005
Location: Sweden
Posted: 22nd Oct 2005 12:30
Thanks I´ll have a look at it as soon as I bought DGSDK (next week waiting for my work pay)
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 25th Oct 2005 00:56
if you want an example of DarkSDK + Newton (native), download my game "Connect More". it has the full source code, which may be of some help, as it uses many Newon features.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 25th Oct 2005 20:06
Connect More wants 'd3dx9_26.dll'. You've included 'd3dx9_25.dll'.

Cheese!

Expert Bug-Finder, Horrible at Identifying Them.
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 25th Oct 2005 21:38
hmm. the source code still works though

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 29th Oct 2005 11:36 Edited at: 29th Oct 2005 11:38
Project information:

I have started to work with the update of the Wrapper together with 5.9b3 now.

<- Got hit in the head by wrapper-addicts forcing me to do it

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 31st Oct 2005 13:31 Edited at: 31st Oct 2005 14:05
Ok, *Done*

Patched the Wrapper and reworked the demos to work using the DBPro 5.9b3 upgrade.

There is also a nice new demo with a loader simulator.

Download @ http://walaber.com/ndb/NDBv_132b.rar
Features @ http://mtec.hostname.nu/projects.htm

Since this is a 'sticky' I thought I might make a copy of the original message so the Wrapper users dont miss the news.

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
FXTC
20
Years of Service
User Offline
Joined: 3rd Jul 2004
Location: CzechRepublic
Posted: 31st Oct 2005 19:01
thanks Kjelle69, good works

AMD 2,4 512MB RAM,2x200GB hdd,GforceFX5700GT128MB
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 9th Nov 2005 17:44
hi,im planning on using this soon,but i wanted to ask a couple questions about it first.

1 using this newton dll,can i use it to keep my player on top of my xfile ground??

2 if i compile a game with it does dbp automatically include this dll?
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 10th Nov 2005 01:37
1. yes you can. see the "fps demo" for how to set this up. it's a little more complicated than you may be used to, so don't get scared, and make sure you look at the other simpler demos first.

2. it includes the Newton Wrapper DLL, but you need to inlclude newton.dll (the acutal Newton SDK DLL) with your finished product.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 10th Nov 2005 02:44
thankyou Walaber!

i also wanted to say thankyou for all the work you and Kjelle do on this physics wrapper!!
i really like it alot! the car physics ive been playing with are awesome!im definately going to try & add this into my game,not too sure where ill use it yet,since im making a horror survival game.

Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 11th Nov 2005 13:46
Heavy Traffic can be like a Horror survival game sometimes

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 14th Nov 2005 09:16
Quote: "since im making a horror survival game."

hey, that is my idea

So you think you're tough? - Zombie Hunter DBPro Beta 1 - December 2005 - Not so tough anymore, huh?
(man, this ad suck!)
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 25th Nov 2005 22:02
I have lived with this for quite a while now, but I'm starting to realise it's a real problem. When the frame rate of my program gets low (below ~60fps) when I use NDB_BodyAddForceGlobal, the rate at which my body (under the influence of the force, applied each loop) moves decreases. I also apply a force upwards, but only one call at a time. This upward force makes the body move upwards and reach greater heights when the frame rate is low. I'm guessing this is because gravity is affected too. This is a severe handicap as my game often runs at less than 60fps, and this causes the gameplay to slow down to as much as 1/10th the normal rate. Not good.

walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 26th Nov 2005 07:30
i assume you are simply updating newton with the time elapsed per frame?

first, the changes in speed you see are because of damping. newton applies a damping factor to bodies each update, regardless of the framerate. therefore at higher framerates bodies are dampened more. the first thing to do is set the linear and angular damping to a lower value than the default. newton currently defaults to 0.1 for each. set them to 0.0001 (both linear and angular damping). this will reduce those effects dramatically.

also, newton clamps the update value between 60fps and 600 fps. if you are getting slower than 60fps, the world might look "in slow motion" because it's only updating at 60fps. most users in big projects are using frame-indepentant update code for newton. usually this is called "time slicing", where you set an update fps for the physics, and update it independantly to the graphics fps.

basically you get a goal deltat for phyics, and update as many times as necessary per loop.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 26th Nov 2005 11:33
Try this simple code to see if your physics behave more realistic:

It checks if MORE time has passed then 0.017 sec. IF so then update newton twice with half the actual time that have passed. (Hopefully the time passed is NO more the sec*2 if so make more updates. You have to time your code to optimize the behaviour here.

good luck and tell us how you succeed !



-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 26th Nov 2005 14:19
Lol, I actually realised from reading the help files what the problem was after I posted. I actually came up with code pretty much like yours Kjelle. The physics behave a lot better now, although that damping feature sounds a bit odd. Does that mean that damping is only really useful in simulations where the frame rate doesn't matter?

Also, this is quoted from the help files...

Quote: "NDB_NewtonSetMinimumFrameRate
syntax: NDB_NewtonSetMinimumFrameRate framerate
framerate minimum frame rate (float 20-1000)

returns: nothing

Comments: Limited to values between 20 and 1000. Default is 60. If the framerate drops below this number, Newton will perform substeps to maintain physics accuracy.

NDB_NewtonSetMinimumFrameRate 30 set minimum framerate to 30fps. "


"If the framerate drops below this number, Newton will perform substeps to maintain physics accuracy."

I took this to mean that if Newton would perform "time slicing" if the frame rate dropped below the minimum fps. What does this actually mean?

Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 27th Nov 2005 01:16
Some links concerning this technology:

http://newtondynamics.com/forum/viewtopic.php?t=1524&highlight=substeps

http://newtondynamics.com/forum/viewtopic.php?t=1008&highlight=substeps

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 27th Nov 2005 01:24
One more:

http://newtondynamics.com/forum/viewtopic.php?t=595&highlight=substeps

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 28th Nov 2005 03:59
that is a mistake in the docs. newton does not perform time-slicing for you when you use that function.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB

Login to post a reply

Server time is: 2024-11-23 11:33:36
Your offset time is: 2024-11-23 11:33:36