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
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 5th Aug 2005 06:39
for god's sake man, read my whole post. obviously there isn't such a command, as I explained that it's a lot more complicated than a single command, and you need to actually read all the materials that nice people have made available to make it easier for you.

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: 5th Aug 2005 10:38
About the joint position and rotation, well. I think you could get the location and rotation of the specific newton object which for example represents the hand of the ragdoll. I have tried to use this technique to attach a ragdoll to the steeringwheel of a car with tremendous and somewhat bizarre results

-==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: 12th Aug 2005 19:15
Ok. And I was wondering, some of my objects are quite small, and are always falling through the floor . Would it be possible to get the continuous collision mode working? It would be extremely handy.

walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 13th Aug 2005 07:17
it's been implemented in the upcoming update to Newton SDK (version 1.5). I think KJelle will update the wrapper...

what scale are you using for Black Out? 1 unit = 1 meter?

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 14th Aug 2005 22:10
I just decided to take a look at newton but...er..all the links are broken, I can link to what looks like walabers site, but all of the newton links don`t work (page not available etc), has this been dropped or something?

walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 15th Aug 2005 06:01
go to walaber.com, click on physics, and scroll to the bottom of the page. there is a download for the wrapper, and the exe's of the demos as well.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Kangaroo2 BETA2
21
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: Somerset / UK
Posted: 20th Aug 2005 19:28 Edited at: 21st Aug 2005 01:54
Hi Walaber and Kjelle69, just a note to say thanks for the continuing awesome work on the physics I have released a demo of a peice of software I'm making using Newton ( http://forum.thegamecreators.com/?m=forum_view&t=58389&b=8&p=0 ), its very similar to fpsc but with physics and allows other types of games, anyway I have learned so much from both your excellent examples and documentation I have written a thank you to both of you in the documents, and will send you free downloads for the commercial versions when they are released B)

I'm afraid I included the "gubbe.x" ragdoll model without asking as a temporary ragdoll before I build my own, I have credited this and will remove it beofrre any commercial release - I hope this is okay with you?

Anyway thanks for the stellar work on the wrappers, docs & examples, these physics really are amazing and make the product a really fun one to play around with

Horus
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Brazil
Posted: 25th Aug 2005 03:51
Hi guys!

I re-compiled the newton demos using DBpro 5.8 update.

The re-compiled "demo05 - fps example" freezes for a while when I shoot the walls (shooting at the boxes works ok) and its hard to
control the camera around the level because the demo forces you to
move back all the time.

The downloaded version (.exe file) works fine on my computer, when o shoot anywhere the demo doesn´t freezes for a while and i can control the camera around with no problems.

Any idea? Do I need to change anything on the source code before
recompile it on the new DBpro 5.8 update?

Trinity... HELP!
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 26th Aug 2005 08:49 Edited at: 26th Aug 2005 08:50
To Kangaroo : You may use my Gubbe.x, credz and maybe a link to website would be great

To Horus:

Make sure you have the right version of the "NDB.dll" in the plugins-user folder, and search computer for occurences of older dll's. (Remove them)

Have the right version of the "Newton.dll" in the actual project folder.

It seems that you have some kind of conflict there.

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
hmm
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location:
Posted: 26th Aug 2005 12:14
Does the vehicle demo (demo 6) crash for anyone else? The screen goes black for a bit the the program ends, leaving me with a txt file that says what line the runtime error was on and the code for the runtime error.
There doesnt seems to be anything wrong with the lines it mentions though.

Any ideas as to what's going on?

I really want to be able to use vehicles properly and the other vehicel demo (simplified one) creates a car that goes crazy and rolls over real easily.

Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 26th Aug 2005 14:40
Odd... I suppose you're tired of hearing this, , but try redownloading all the newton parts and reinstalling everything. The simplified vehicle demo will indeed go crazy and roll all the time, I haven't bothered trying changing the values around to make it more stable.

Kangaroo2 BETA2
21
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: Somerset / UK
Posted: 26th Aug 2005 17:25
Thanks And yup you're already mentioned in the help files and a read me under the ragdoll model As I said I'll eventually replace it with my own, its just to show the capabilities. The Newton examples and stuff are great though many thanks!

To people having problems with Newton and dbpro 5.8 but can run the exes perfectly, I had exactly the same problems but for some bizzare reason that I don't understand I was told to try updating my official IDE to the latest version, which I did, and it fixed it! I don't understand why, but it did. Also obviously make sure you're using the latest versions of the wrapper and newton.dll and that you have deleted the old versions.

Cheers, Sam

Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 27th Aug 2005 18:10
So... any word on the next wrapper update?

Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 27th Aug 2005 18:24
First Julio must release the next version of the Newton Dynamics system. Then I can take a look into the SDK and see if I can implement the new functions into the Wrapper.

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Horus
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Brazil
Posted: 27th Aug 2005 19:41
Kangaroo2 BETA2! You´re a Hero!

Thanks a lot! Every thing here was updated, except the DB PRO editor.
Since you told us to update the IDE, I did it and all the Newton demos jus compiled and run without problems. Thanks a lot.

The question stands: Why does everything works after the IDE updating?

Anyway, now I can study the fantastic game universe with no frustration.

Much Game for you all!
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 1st Sep 2005 05:23
Hi,

I'm having a weird problem with convex hulls. It seems like about 10% of the time when calculating them, something odd bugs up and... well, the picture describes it best:



Note the mesh shaded in red, which should be neatly encompassing the table.

If this happened all the time I would assume it had to do with the nature of the mesh, but it seems to be completely random; I can run the same .exe once and not get it, and then again and several meshes will have bugged up.

Any ideas what might be wrong?

If I looking for blog
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 1st Sep 2005 06:13
i had this exact problem , also convex hulls sometimes look prety complicated so why is it that we cant use a mesh as a collision object?


walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 1st Sep 2005 07:11
there must be a bug in the convex hull creation code in the wrapper, maybe Kjelle can take a look at it. it's probably something funny with the memblocks.

I would generally guess it's the model, but maybe not since you claim it works sometimes on the same model. what it does internally is pass EVERY vertex in the model to newton, and newton makes a small convex shapes that includes all of those points. so it you're model has a stray vertice (with no polygons attached to it) out somewhere funny, Newton will include that point. so imagine in your modeller if you forgot to delete a vertex out somewhere. you won't see it visually (because no polys touch it), but it will be passed to Newton when making the convex hull, and that could cause the problem you've mentioned.

as for using meshes as a collision object, convex hulls have a requirement that they are a completely "convex" object (hence the name), which is MUCH faster for calculation collision and other physics calculations, which is why Newton requires it.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 1st Sep 2005 15:00
wallaber, i have ad the exact same problem ironically with a table as i showed before, im certain i do not have any stray verts so its not the mesh thats the problem.


Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 1st Sep 2005 15:41
I believe the next version of Newton will have the ability to create a rigid body in other non-convex shapes by combining several convex hulls into one body. Though I may have mis-understood .

Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 1st Sep 2005 22:40
Thanks hamish, dark coder, Walaber. I'll check out my models just in case there are any odd polygons, it's unlikely but possible.

The lack of true dynamic mesh physics isn't a problem, convex hulls work fine, as long as they can operate correctly . Anyway since Newton and the wrapper are both free I don't have a right to complain. Hope it gets fixed, Newton's great fun to work with

If I looking for blog
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 5th Sep 2005 02:31
After making some adjustments to the meshes I'm not getting this problem any more. 'Holes' in the objects seem to cause it, but there's also something else I haven't quite been able to figure out yet. Generally closing holes and welding all the verts to their partners in Milkshape fixes it though.

If I looking for blog
ALPHA ZERO PRODUCTIONS
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Mom ! I forgot where we live !
Posted: 5th Sep 2005 21:30
How do i make newton work with the terrain commands ?

Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 6th Sep 2005 01:03
You... could try the advanced terrain demo

ALPHA ZERO PRODUCTIONS
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Mom ! I forgot where we live !
Posted: 6th Sep 2005 01:29
i don't have advanced terrain

Kangaroo2 BETA2
21
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: Somerset / UK
Posted: 8th Sep 2005 23:31 Edited at: 8th Sep 2005 23:33
" Kangaroo2 BETA2! You´re a Hero! Thanks a lot! Every thing here was updated, except the DB PRO editor. Since you told us to update the IDE, I did it and all the Newton demos jus compiled and run without problems. Thanks a lot."
No problem As I've said, absolutely no idea why, but if you don't do this you get some really weird physics behaviour!

"i don't have advanced terrain"
Yes you do. Advanced terrain commands are built in to DBPro 5.8 so as long as you have updated DBP 9and updated the IDE also, as mentioned above) you have the commands. Then use the demo example that comes with the wrapper to show you how to use it Maybe you're confused as initially it was a separtate download and there was even a version planned that you had to pay for. However that hasn't lead to anything yet, and Advanced terrain support is now in 5.8 as standard, for free

Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 13th Sep 2005 12:55 Edited at: 13th Sep 2005 12:55
I've been playing with newton recently and I've found a couple of things that I can't find answers to. Remember my philosophy, the only stupid questions are the ones you already know the answer for! Anyway:

For these commands:
NDB_NewtonSetSolverModel
NDB_NewtonSetFrictionModel
In the help files that come with the wrapper it says the settings are O, L and N, for the solver and O and L for the friction, unless I'm reading it wrong. But since the parameter should be an integer I don't see how I'm supposed to change the settings. Can anyone offer some help? Also, what're the default settings for these?

I've found what seems to be a potentially nasty problem with the physics. The following code was the start of a game, so there's some stuff in there I haven't removed:

Ok, this code sets up a simple scene with no need to external media, there's a block for a floor and a simple box. Move the camera around with the mouse and fire the block from the camera with the left mouse button. By holding the space bar the program will change the time step being given to Newton to slow time down in a sort of bullet time effect.

The potential problem is that the block seems to travel a different distance depending on what speed the time is running. It travels further at normal time then it does at 0.1. It seems to me that the movement damping has a greater effect the more times per second newton updates. I realise that floating point variables are notorious for having accuracy problems, but the difference I'm getting between the two speeds is huge, at normal time speed the block travels quite a distance and bounces a few times, while at 0.1 speed it hits the floor near the middle point and stops pretty much dead in it's tracks.

Could some other people try out the above code and see if you're getting the same problem I'm getting, and does anyone have any idea what's going on?

Thanks.

Don't look at me like that!
You're just jealous because the voices are talking to me!
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 13th Sep 2005 13:41 Edited at: 13th Sep 2005 13:47
To Avan.Madisen:

Most important !! ITS NOT O, L and N, its Integers : 0 1 and n (number between 2 - n passes )

NDB_NewtonSetSolverModel

Comments: This function allows the application to configure the Newton solver to work in three different modes.

0
Is the exact mode. This is good for application where precision is more important than speed, ex: realistic simulation.

1
Is the adaptive mode, the solver is not as exact but the simulation will still maintain a high degree of accuracy. This mode is good for applications were a good degree of stability is important but not as important as speed.

n
Linear mode. The solver will not try to reduce the joints relative acceleration errors to below some limit, instead it will perform up to n passes over the joint configuration each time reducing the acceleration error, but it will terminate when the number of passes is exhausted regardless of the error magnitude. In general this is the fastest mode and is is good for applications where speed is the only important factor, ex: video games.
Remarks
the adaptive friction model combined with the linear model make for the fastest possible configuration of the Newton solver. This setup is best for games. If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.

NBD_NewtonSetFrictionModel

Comments: This function allows the application to chose between and exact or an adaptive coulumb friction model

0
Is the exact model. Friction forces are calculated in each frame. This model is good for applications where precision is more important than speed, ex: realistic simulation.

1
Is the adaptive model. Here values from previous frames are used to determine the maximum friction values of the current frame. This is about 10% faster than the exact model however it may introduce strange friction behaviors. For example a bouncing object tumbling down a ramp will act as a friction less object because the contacts do not have continuity. In general each time a new contact is generated the friction value is zero, only if the contact persist a non zero friction values is used. The second effect is that if a normal force is very strong, and if the contact is suddenly destroyed, a very strong friction force will be generated at the contact point making the object react in a non-familiar way.

Remarks
the adaptive friction model combined with the linear model make for the fastest possible configuration of the Newton solver. This setup is best for games. If you need the best realistic behavior, we recommend the use of the exact solver and exact friction model which are the defaults.




Concerning the timestep, it has been discussed in depth on the Walaber forum, for example in this thread: http://walaber.proboards23.com/index.cgi?action=display&board=newtdiscuss&thread=1110824950&page=1

Search for framerate or timing or time

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 13th Sep 2005 18:31 Edited at: 13th Sep 2005 18:32
That explains it! I was reading it wrong, sorry, I'm dyslexic. (bashes head on keyboard)

I get the impression that you have misunderstood me with my question regarding the time steps. I'll try to explain it again to see if I did get the message across first time.

I seems that the damping effect on the movement of an object is having a greater effect on the object the smaller the time step. For instance, if you're running a simulation at with constant time steps of 0.01 seconds, objects will move as if they have less damping then if it was a time step of 0.001 seconds. Shrinking the time step further would have the objects flying through a thick sludge! As you may have seen in my above code I haven't touched the damping so it's using the default value. Also mentioned in my above post the difference between the two time steps is huge, the larger time step results in the object traveling nearly 3 times the distance it travels with the smaller time step!

Here's another slightly more drastic explaination, it seems like the damping effect is not taking the time step into account when it's being calculated! That is the problem I'm experiencing, although I'd be shocked if that was the acual cause!

Was that clear in my first post, or did it seem like I was waffling? Or am I still not making sense?

Don't look at me like that!
You're just jealous because the voices are talking to me!
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 13th Sep 2005 18:57
Again, it is very important to understand how the timestep affects the simulation, if you put a much smaller timestep then Newton calculates where the body would be if you only stepped the newton world time a very small time, If your program loop is longer than the timestep then it seems like if the damping is higher than in reality.

Try to look after more info of this topic in the Walaber.com forum and in the newtondynamics.com website.

I have a very bad pedagogical way of explaining things sorry.

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 14th Sep 2005 00:41
Damn, first time I've ever seen the word "pedagogical", I assume it's based on the word "pedagogue"?

Anyway, I still think I haven't explained it right, anyhow I'll be sticking with a fixed update speed most of the time, so it won't be much of a problem. I'd just prefer to use variable frame-rate code but, we can't have it all.

Thanks.

Don't look at me like that!
You're just jealous because the voices are talking to me!
Kjelle69
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: Sweden 150 km north of arctic circle
Posted: 14th Sep 2005 08:01
It's possible to use variable framerate ! Try to get in touch with Walaber, he maybe could explain it in a better way .

-==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: 17th Sep 2005 06:47
it's a fact that changing the timestep will affect the damping. the quick and dirty solution is to set the LinearDamping for the body to a very low value (0.0001). this will reduce the effect of damping so it's less noticable.

the proper way to do it is to implement frame-independant updates for the physics. basically what this means is that you decide a "goal" fps for the physics to update at, and you update at that frequency regardless of the actual framerate. it's called "time-slicing", and it will make your physics MUCH smoother, and the results will always be the same, because you are updating Newton with the same timestep each time. this will create perfectly accurate "slow-motion", or even fast-motion.

basically you do this: (psuedo-code)


this will update newton several times per loop, maintaining a set FPs for the physics, regardless of the actual game screen FPS.
this is VERY simple code, and doesn't take into account problems with very low framerates (it will keep looping until it "catches up"), but I think you get the idea.

implementing this into any physics project will result in much smoother and reliable physics. you can always try different goal FPS for the physics, to get a good balance between stability and game FPS (too accurate physics take too long to calculate).

in my ConnectMore game, I think I used about 180 fps for the physics, because of the fast-moving balls.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 18th Sep 2005 00:36
Quote: "basically what this means is that you decide a "goal" fps for the physics to update at, and you update at that frequency regardless of the actual framerate."


Yep, basically forcing newton to update at a certain frequency. It's a lot easier to use IanM's high frequency timer plugin, you can set it to any freqency at then use that.

Problem is you can't really do slow-motion with this method without changing the the timestep or using a disgustingly high frequency update that would probably require a 4ghz processor!

I am surprised that the damping effect changes by as much as it does, I'd understand there being a small percentage difference in the change in time-steps but the changes I'm getting are huge, you got any ideas on that, Walaber?

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: 18th Sep 2005 16:58
of course you can do slow motion. just pretend less time has passed than really has, and pass that to your time-slicing code (like I posted). this will actually run faster than "real time", because it will take less loops of the code to fulfill the required update.

as for damping, it's exponential because it's applied every frame. so if it's set high, it will show it's effects extremely rapidly, especially on high-fps cases. the only solution to an equal simulation on 2 different systems, is to guarantee that Newton will be updated with the same timestep on both systems. Time-slicing takes care of this perfectly.

Go Go Gadget DBPRO!

Athlon XP 2400+ || DDR-SDRAM 1GB || Nvidia GeForce 4 Ti4200 AGP 8x 128MB
Hoopkid ups
19
Years of Service
User Offline
Joined: 24th Nov 2004
Location:
Posted: 18th Sep 2005 23:28
This is slightly off-topic, but...

Is there a way to exclude an object from a newton raycast?

Thanks!
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 19th Sep 2005 00:38
Walaber - That's where the problem lies, say you're running the physics at 200 updates per second, and you put slow mo in which slows it down to 1/5th speed. By reducing the number of updates persecond but keeping the timestep the same it would work, but at 1/5th speed it would be running at 40 updates per second, take it further to 1/10th speed at you're down to 20 updates per second. This would become noticable jerky and running at something like 1000 updates per second would kill some older systems!

Another solution I thought of that is really just a nasty hack, is to spend a fair amount of time testing the damping and different time steps to find out how to change the damping based on the time step to produce at least similar movement. This would need to have the damping for every body changed every frame but the problem I have with this solution is that Newton should be taking care of all that automatically!

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: 19th Sep 2005 06:42
you have a point, but 1/10 speed is REALLY slow you know. in most films, "slow motion" is just 1/2 speed, or up-to as slow as 1/4 speed, unless they're really going crazy with it.

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: 19th Sep 2005 16:26
Trying to summarise the solution:

Update Newton many times / program loop with small time intervals passed to the update newton function.

Example if real time passed = 1 sec.

Update newton 10 times with 1/10 sec each program loop.

If you want to do slow motion with half speed,

Update newton 5 times with 1/20 sec each program loop.

This way the objects should move equal distance, but in 50% speed.

-==The tame birds yearn, the wild ones dare to fly.==-
http://Mtec.hostname.nu
Avan Madisen
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 20th Sep 2005 00:50
Yeah, good point Walaber, the only time you'd want extreme slow-mo is during cutscenes, and those you could set up specifically for that sort of speed or use newton to record the movements into a script so you could guarentee the cutscene always worked exactly the same way.

Hoopkid ups - Just to make sure your question doesn't go unanswered, would freezing the body do? There's that freeze body command somewhere in newton that excludes it from processing.

Don't look at me like that!
You're just jealous because the voices are talking to me!
Hoopkid ups
19
Years of Service
User Offline
Joined: 24th Nov 2004
Location:
Posted: 20th Sep 2005 01:10
The problem I was having was that I used a raycast for a gunshot, and since I had the ray projected about .2 seconds after the mousclick, the player might be in a different position by then, and the ray would intercept the collision sphere for the camera. For some reason, freezing the object did not work, maybe because it was moving, but I found a work around. I moved the sphere to the position it was in when the user clicked, cast the ray, and moved it back. It seems to work for right now, but thanks for your reply .
walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 20th Sep 2005 06:50
or just cycle through the raycast results, searching for other objects than the player. or cast the ray from a slightly farther position from the player.

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: 28th Sep 2005 21:51
allrighty, since noone seems to be able to help me over at the newton forum anymore, i thought i'd post here.

i am writing AI for my game. im using newton (obviously)

when the zombie is going to move, it uses same method as the player (from the fps example).
the only changes is that instead of: if scancode.... i use if canMove... etc. etc.

but the problem i am getting is that (and i have studied the code A LOT, tried MANY different ways to do this) is that the zombie just wont move.

i have checked the AccX# and Z variables and they are going to 100.0 at ONCE. that shouldn't be. (100.0 and -100.0 is maximum acceleration) and the zombie does not move at all.
with the player, the Acc variables are at < 10 or > -10 and when i collide with something they are 200.0 or -200.0 that should be so.

but anyway, the zombie:
it has accelereation on both X and Z axis but it is at 100.0.
it does not move.
when i collide with it, it is as it was charging for a big explosion and when i collide with it it gets blown away and outside the newton world.

i have no idea why this is happening.

obviously the acc is at 100.0 because the zombie stands still, as if it was stuck in the ground, but why?

any help/tips would be GREATLY appreciated.

if source is needed then just tell me (game will be open source anyway)


walaber,
what happened to the forum?
and i love that new nice awesome website of yours
when i get better at php i might wanna try to make it function as yours if that is ok (will still keep my own style though ehh.. not that yours is ugly, i LOVE it!)

Hawkeye
21
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 28th Sep 2005 22:27
Eh. You did enlarge the newton world so it's big enough, right?

Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 28th Sep 2005 22:35
ofcourse! lookie here: (damn.. paint doesn't work)

what i was going to draw:
the newton world size is 100'000 dbu (dark basic units)
the level is only around 100 dbu
zombie takes around 1x2x1 dbu (so does player)
player collide with zombie, zombie is blown away
hit the newton "wall" and gets deleted.

walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 29th Sep 2005 02:58
obviously you have set AutoFreeze to zero, and friction between the zombie and the level to zero, right?

the only reason the zombie won't move, is if it is frozen, or you aren't properly applying the forces.

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: 29th Sep 2005 08:47 Edited at: 30th Sep 2005 12:11
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 29th Sep 2005 17:17
sorry for double posting, but that is because i want this thread to go blue

i just got home and i checked through my code.. no autofreeze.
i check the newton docs, page up autofreeze and read:
Quote: "Comments: Newton automatically removes bodies that have reached a state of equilibrium from
the active body list. In essence, bodies that are in a state of rest, are "forgotten" by the engine until
some force puts them back into motion. However for some objects, like characters, AI-driven
objects, this can cause problems. Setting the flag to "0" for a body will keep it permanently in the
active list. It is not recommended to do this for many objects, as performance will be severly
affected. Bodies default to an AutoFreeze "on".
"


thanks for that tip walaber. you are the man. the man.

ps. it works now. wooot!1!!

Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 29th Sep 2005 20:22 Edited at: 30th Sep 2005 12:25
im triple posting, because i want this post to stay blue so you guys know that i have posted. because i cant wait for anyone to accidently drop by, just to notice me edited a post. you understand what i mean, yes?
ok. the movement works perfect now, thanks to walabers tip.
but how come a rigid body can ONLY be rotated between the angle 0..180?
if i print "object" angle i get somthing between 0..180
if i print "rigid body" angle i get something between 0..-0 (0..90..-0)
what might be causing this problem?
[edit]
the problem is: the object/rigid body can NOT rotate more than to that angle. no matter how i write it. if i write 270 it will rotate to 180 then stop at 180.
[/edit]
i will read some more in the docs incase there is something i have missed. but please post any tips/solutions here


edit,
i have read through every document on newton i have on my computer.
all i found for rotation was: NDB_NewtonBodySetOmega and NDB_BodySetTorque and NDB_BodyAddTorque.
i have tried all of these 3 commands, but still no luck. it rotates to 180 degrees, then stops. or it rotates to 0degrees then stop.

please help me

ps. this is how i rotate my body: (i took demo01 and modified it)

Quote: "
`before the loop
new_angle# = rnd(359)

`inside the loop:
NDB_BodyGetRotation Cube
current_angle# = NDB_GetVectory_Y()

`now i call one of the 3 rotation commands
if current_angle# < new_angle# then NDB_SetVector 0.0, 1.0, 0.0 : NDB_BodySetTorque Cube
if current_angle# > new_angle# then NDB_SetVector 0.0, -1.0, 0.0 : NDB_BodySetTorque Cube
"


walaber
21
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 2nd Oct 2005 01:50
that's a problem with Euler angles. you can get the angle yourself by getting the Matrix for the body (NewtonBodyGetMatrix), and then finding the angle between the "X" vector, and some known vector (like 1,0,0). the angle between these 2 vectors is your "Y" Yaw rotation angle. you can calculate the angle with the "dot product" of the 2 vectors.

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:00:29
Your offset time is: 2024-11-23 11:00:29