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.

Dark GDK / Physics plug-in powered by PhysX

Author
Message
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 24th Mar 2010 10:35
@dark coder - check your email.

@Fersis - Glad its working, let me know if you have any more issues, thanks.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 24th Mar 2010 12:19
Quote: "@dark coder - check your email."


Thanks, though the rotations are still wrong for certain angles, I notice the rotation matrices are multiplied in the wrong order and for some strange reason they break when you set them to 90 degrees or something. That is, 0,0,45 looks fine, 0,80,45 looks fine, then 0,90,45 totally changes for some reason.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 24th Mar 2010 13:02
Wow, you're right dark coder, don't know how I missed that.
I've changed the rotation order and thats working fine now, I just need a bit more time to try and fix the 90 degree thing, as far as I can see it is only when the y-rotation is 90 but I need to do more testing and put in a fix.

I will make an update later which will at the very least fix the rotation order and hopefully the 90 degree thing too.

dark coder, I will email you later, thanks for your help.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 24th Mar 2010 23:54
Version 1.2.2:
Fixed rotation order and fixed(worked around) the y rotation issue, if the objects y angle is 90 or 270 it will offset it by 0.1 to work around the issue.

While doing testing I noticed the convex mesh functions also raise rotation issues sometimes, I will look at this for the next version unless someone needs it fixing now.

Updated top post and attached just the Lib folder here for anyone who has version 1.2.1.

@dark coder - email

Attachments

Login to view attachments
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 25th Mar 2010 07:43
Quote: "if the objects y angle is 90 or 270 it will offset it by 0.1 to work around the issue."




Anyway the latest version works much better, though if you use the freeflight functions(dbRollObjectRight etc) then the rotations still appear to be incorrect for some reason. Couldn't you just use the rotation matrices from GDK rather than constructing new ones? Or maybe PhysX uses a slightly different coordinate system.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 25th Mar 2010 16:03 Edited at: 25th Mar 2010 16:16
Quote: "Couldn't you just use the rotation matrices from GDK rather than constructing new ones? Or maybe PhysX uses a slightly different coordinate system."


Yeh, I was doing this originaly but if you change the GDK objects rotation matrix directly then you lose the rotation angles, in other words dbObjectAngleX() etc dont change.

I suspect that my original way might be quicker though and it may work better with free rotation so there may be two updateActors() functions in the next version.


EDIT: Actually, you may have a point there, for Tri-meshes, this might be possible, I will look into it.

Merak Spielman
15
Years of Service
User Offline
Joined: 14th Jul 2008
Location:
Posted: 27th Mar 2010 02:34
Quote: "
I just pulled 1000 out of the air, its kind of a gravitational constant.

Should not be too difficult to use with multiple planets, just plug in the planets position instead of my constant gravity point.
You could create a function:

+ Code Snippet

applyGravitationalForce(int gravityObjectID, int orbitingObjectID)
{
// g = 1000 or whatever
// calculate distance betwwen two objectsalong each axis disX, disY, disZ
// then forceX = g/(disX * disX) etc...
// looking at that I'm not sure if squaring the distance
// will mess up direction of force, would need to code it
// and see.
}



Something like that anyway"


I've been doing some research and getting gravity working properly is kind of irritatingly difficult, especially if you, like myself, insist on it being accurate.

If you have a (for the sake of simplicity) stationary "Sun" body, and want to make a planet orbit around it, it's fairly easy to test whether it's simulating correctly.

1) Make trails follow your planet so you can judge the orbit shape accurately (I finally got this working, ask me if you can't figure it out)
2) Position your Sun at 0,0,0. This doesn't matter in the slightest as far as the simulation is concerned, but makes it easier to measure and test things.
3) Position your planet along the X axis.

<SIMULATE>

Your planet should fall towards the sun and land on it, and remain there perfectly stationary. This is an intermediate test to make sure you're not screwing up too badly. Bounciness should be off or it gets weird.

4) Apply some initial force to your planet along the Y axis. that is to say, at a right angle to the direction of the Sun.

<SIMULATE>

At this point, only 3 possibilities should occur. If something else occurs there is a problem with your equations.

POSSIBILITY 1) Your planet crashes into the Sun, and rolls around it. It should remain in constant contact with the Sun. Essentially it has "fallen against" the surface of the sun and is now resting on it.

POSSIBILITY 2) You have applied enough force to achieve escape velocity. Your planet will fly off and not come back. Its velocity exceeds the pull of gravity, and it's off to explore the universe. If your planet suddenly vanishes, this is probably what happened. Apply less force.

POSSIBILITY 3) You achieve an elliptical orbit. The Sun is at one focus of the ellipse. The planet orbits and returns to precisely its starting point. The ellipse will be perfectly symmetrical, mirrored along both sides of the x-axis (where both your planet and sun began). Lots of possible ellipses are possible, from nearly circular to very elongated (irregular).


I have checked and double-checked and triple-checked my gravity equations with people who should know. The math should, at this point, be impeccable. Certainly enough man-hours have gone into it. It's entirely possible we're missing something very obvious.

What happens in my simulation:

0) If I begin the simulation with no initial force applied to my planet, it approaches, accelerates towards, and crashes into the Sun. Then it remains still. This is the only scenario that works properly.

1) If I apply some initial force and my planet crashes into the Sun, it starts rolling around it. After a few circuits, it begins to accelerate. Then it takes off, and starts spiraling outward slowly. It spirals out to infinity, with an ever-increasing orbit.

2) I can't tell if the escape velocity scenario is working because I lack the patience to wait that long. It looks like it's starting to orbit, then slowly floats away. Then it goes slower and slower until I can hardly tell it's moving, but never falls back against the Sun. I assume it's traveling outwards. Maybe I'll leave it going overnight and see what happens.

3) When I apply enough force to "miss" the planet, but not enough to "escape", I should be entering a nice elliptical orbit. It is never symmetrical along the x-axis. When the planet nears its starting point, I can tell by looking at the trails that it has gone outwards a little bit. Left to orbit several cycles, I can tell it's orbiting further and further out on each cycle, out to infinity.

I'm pretty sure the equations I'm using could be simulated with some of the functions in Physx or your library, but here is the basic math:

TotalForce = (G*mass1*mass2)/(distance squared)

This is a standard gravity equation. G is the gravitational constant and is equal to 6.67300 × 10^-11. I usually just put it in as 0.00000000006673 as a long double.

To get the distance between the objects along each axis:
x distance: (x2-x1)
y distance: (y2-y1)
z distance: (z2-z1)

To get the total distance (used in the gravity equation):
TotalDistance = squareroot( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2 )

Now we know the total force. What we need to do is divide up the total force along the x,y, and z axes. This is called normalizing the vector. I think there's a function in darkGDK to do this, but I just wrote it myself. Dividing the axis-distance by the totaldistance yields a number from 0 to 1, essentially a percentage. Multiplying this by the totalforce yields the percentage of the force that is supposed to be applied in that direction. The sum of the normalized distances should always, at any given moment, be exactly 1.00.

forcex = (distancex/TotalDistance) * TotalForce
forcey = (distancey/TotalDistance) * TotalForce
forcez = (distancez/TotalDistance) * TotalForce

now we just apply the force. Using your applyforce function it looks something like this;

applyforce(PLANET_ID,forcex,forcey,forcez)



I can give more detail and explain the math if anybody needs me to. This SHOULD be right.

So I do not understand why my results are so abnormal.
Merak Spielman
15
Years of Service
User Offline
Joined: 14th Jul 2008
Location:
Posted: 27th Mar 2010 02:39
(can you edit posts in this forum?)

Just to add, the above equations are to determine the forces for a single body relative to another one. To make it really work, you'd have to run that loop once for every body relative to every other body. I can see this clogging up the system pretty rapidly if I tried to do something silly like simulate an entire solar system, to scale.
Merak Spielman
15
Years of Service
User Offline
Joined: 14th Jul 2008
Location:
Posted: 27th Mar 2010 06:07
I'm no longer certain about my math. If anybody can check it for me I'd appreciate it. My simulation is doing bizarre things when I try to fix what I see.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 27th Mar 2010 15:33 Edited at: 27th Mar 2010 18:15
I have not got much time this weekend as I have an assignment due Monday, after that though I would be really interested in getting this working.

I see you are using some very small numbers and probably some very large ones, if I was you I would try and get a scaled down simulation working first with more regular values, I know this is not what you are after but at least if that works you know your equations are correct and it may be more of a number accuracy problem.


Edit:
Also, since you are looking for component forces along each axis and you already have the distance as components of each axis, can't you skip working out total distance, total force etc..
Just work out xForce by squaring its distance and dividing G by the result, just remember to multiply by a force direction value, 1 if xDistance is positive and -1 if negative.

That works in my head but it would need testing.

TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 7th Apr 2010 07:53
Hey matty, what features are enabled for the version of Fulcrum in the last DOSP update?

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st May 2010 21:59
New update should be inbound soon, lots of new stuff.
Raycasting, collision grouping and contact reports, error handling is back. It also now has vehicles, I'm going to put a video together to show them off, watch this space.

Hassan
14
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 2nd May 2010 15:15
woo sounds interesting good luck mate!

haliop
User Banned
Posted: 2nd May 2010 15:45
yeah matty comeon!!! i want to play blue beatler game!!!!
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 2nd May 2010 22:19
I've been checking out the web-site for PhysX. It appears to only work with NVidia cards, is that correct? If so, unfortunately I have an on-board "Mobile Intel(R) 4-Series Express" chip-set. I don't believe they would be compatible...

I have downloaded it, but not installed yet. I don't want to mess things up by installing an incompatible set of drivers...

As such, I just wanted to say that I'm sorry matty, but I don't believe I'll be able to use your fulcrum-physics tool-kit...

JTK
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 3rd May 2010 02:23
Well, now I'm torn...

I got DarkPhysics working (all of the samples except Vehicle) and as it turns out, DarkPhysics was wanting me to download the drivers too...

So, as the conservative risk-taker that I am, I dove off of the cliff and sure enough, the parachute opened! Those drivers are working for me...

Anyway, since I had to download and install them, I figured I would give Fulcrum a chance. No luck!

The attached image will show an access violation. The line showing the break-point is where it occurs and as you look at the call-stack, it's happening inside the PhysXCore.dll (address is shown in image)

Let me know what suggestions you have (if any) and I'll give it another shot!

JTK

Attachments

Login to view attachments
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd May 2010 14:29
JTK - You don't need a NVIDIA card to run PhysX(as you now know), if you have a NVIDIA card then you can run the physics on the hardware, speeding things up alot.


I will take another look at that example, I took out error handling in that version but it will be back in the next version so any problems should be easier to identify.

Have you tried to use Fulcrum, other than that exe?

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 3rd May 2010 16:52
No not yet. I updated the dark physics stuff which really hosed my system so I spent the rest of the day trying to get it back to the way it worked before.

I was wanting to use your sample so that I can step through the code and try to understand what's happening when and why. I need that knowledge because ultimately I'll have to write a wrapper around it to interfce with my own classes plus to identify the required interfaces accordingly...

For instance, all of my gdk 3d access is through a CEntityObject base class which is the parent class to CEntity and all of my game objects derive frome one of those two classes.

Note: CEntity is a collection of CEntityObject classes with the current active object receiving all 3d related commands... Pretty neat stuff...

JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd May 2010 18:47
If I'm right, you should have a folder "Physics demo", in that is an executable "Physics v1.1 test.exe", could you try and run this and see what happens?

Have you wrapped all the DarkGDK functions in your CEntity class?
Or do you just keep the ID number and access the GDK commands through that:

Just wondering as I'm always torn between which way to do it.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 3rd May 2010 19:09
That program works fine. As for the wrapping, I use the first approach. The I'd is entirely handled inside the class itself - shout out to TechLord for his content manager. I did rewrite it to be parameterized as he was considering himself... Lol

I'll post the acual code in the competition thread when its ready but as a teaser...



Of course, in the game babe inherits from CEntity and holds various CEntityObjects for her animations and we just call babe.SetCurrentObject(MOVE) to activate her move animation...

Hope that helps explain things...


JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd May 2010 19:36 Edited at: 3rd May 2010 19:37
Just as a long shot, I have shadows on in the demo you are having trouble with, does your card support shadow shading? it probably does but try commenting out that line(just above your breakpoint). I doubt its that but worth a mention.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 3rd May 2010 21:10
I'll try when I get home prob won't be able to respond with those results for about 6hours or so - at work now...

JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd May 2010 22:04
Yeh, no problem, I appreciate you helping me out, I need as many people to test this as possible. When this thread goes quiet I don't know whether all the issues have been fixed or its just that nobody is using it lol.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 4th May 2010 03:51 Edited at: 4th May 2010 03:58
@Matty: I got it working... No, the shadows didn't make a difference, neither did changing the parameter to myPhysics.start()...

What it was, however, was really an annoying coincidence. As it turns out, somehow my nxCooking.dll and nxCharacter.dll files were corrupted (or something). I copied the ones from the working program into that directory and tried again... Presto!

Now, I did install the NVidia drivers, and unless I have the following DLL's present, I get bomb-out errors (unable to find DLL):

* NxCharacter.dll
* NxCooking.dll
* NxExtensions.dll
* physxcudart_20.dll
* PhysXDevice.dll
* PhysXLoader.dll

Does that sound right to you? I ask because you only provide the first two in your directories (I put the rest there). I'm using version 9.09.1112 btw...

Hmmm... I wonder if that's the same problem with the Vehicle sample that I can't get working... I'll get back to you on that one.


Sorry to have boggled your mind so, lol...

JTK

EDIT: Nope! It don't make a difference in the Vehicle sample. It bombs out on the call to dbPhyBuildVehicle ( 2 ); - Oh well, guess I don't get to use vehicles... lol Probably has something to do with my DarkPhysics installation itself (I put the first update back in but not the second).
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 4th May 2010 04:34
Quote: "@dark coder - check your email."


Well now that's not fair! While I haven't yet went through the trouble of rebuilding GDK for my purposes, I do plan too - no since for the competition thread so I haven't... I want to "check my email"... What'cha say?

JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 4th May 2010 15:22
Glad you got it working, I'm pretty sure my vehicles will work for you when I update.
Missing dll's are not really a big problem as it tells you exactly what you are missing in the error message, I only include them two because thats all thats needed for that example.

Yeh, I sent dark coder the source as he has his own build of GDK, he also found and solved a couple of issues that I was not aware of so I wanted him to be able to use Fulcrum.
I didn't really think anyone else would ever have the same issue, I have put hundreds of hours into this and there is a possibility that I may sell some version of it someday, but maybe not, I am just keeping my options open at the moment.

If I ever stop working on it and I'm not selling it anywhere I will release the source code for everyone, hope thats fine.

haliop
User Banned
Posted: 4th May 2010 16:39
we dont care! where is the vehicle demo!?!?!?! arggggg
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 4th May 2010 17:15
haliop - its coming, you wouldn't believe how much time it takes to put demo's, tutorials and documentation together.

I am using the vehicles you get with DarkGDK, you could use your vehicle but as you know you would need a wheel that you can texture once its been added as a limb, or add the wheels in your modelling program.

haliop
User Banned
Posted: 4th May 2010 17:16
can i honk?
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 5th May 2010 04:59
@Matty: Yeah, I understand your thoughts there - trying to make an honest buck - and I don't blame you there; but may I at least get a DEBUG version of the library(s) .LIB file(s)?

I hate to be a bother but I compile my programs with warning-level 4 (rather annoying sometimes but I have always been that way). I hate seeing WARNINGS when I compile.

Now, I am familiar with (and am using #pragma warning(...) commands) for all of the FulcrumPhy.h stuff (nx-related), but they do no good when it comes to the linker - and in DEBUG mode I still get:



once for each module in your library (appears to be 7-CPP files?)

Again, warnings... I hate warnings...

DEBUG build please - /Zi compiler option...

JTK


Alternatively, a method of ignoring LINKER warnings would be fine too if I absolutely have to do that - but I'm not aware of such options...
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 5th May 2010 14:57
Yeh sure, dark coder mentioned that too, I will release with a debug lib.

Hassan
14
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 5th May 2010 15:45
Quote: "Yeh sure, dark coder mentioned that too, I will release with a debug lib."


little off-topic, dark coder is still around? he haven't been posting for a while now

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 6th May 2010 05:28
Ok Matty, or anyone really; please tell me what I'm doing wrong.

I created a new 3D game using the wizard (which required changing the /MT compiler setting) and changed the main.cpp to be this:



Notice how all I did was add the myPhysics calls and comment out a line about object-scaling.

When I run this program, I would expect the balls to fly off in some direction (presumably down) but nothing happens.

I don't touch the keyboard to try and follow them, I don't move the camera in any way so I would excpect something to happen...

Am I missing a step or something? If so, what?

Thanks in Advance,


JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 6th May 2010 11:31
You are missing calls to getPhysicsResults() and then simulate():



I also added physics to this example, here are some things you might want to do different.
* .makeGroundPlane()
* Keep the scaling on and use .makeConvexMesh() for each shape
* You dont need to enable gravity for each object, that is the default.
* Dont try to rotate the objects in the loop like that, they are now dynamic actors so the physics will handle all their positions and rotations, if you want to rotate them use .applyTorque().
* The force you apply on creation is too small for a one off force, try putting it in the loop or make it bigger, although you don't need this at all really for this example.

Its pretty cool watching them scaled spheres we all know so well come to life

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 6th May 2010 12:48 Edited at: 6th May 2010 12:49
I was just trying to get *something* to happen. Thanks for the help. Now could you take that example and load an instance or two of "babe.x" (GDK Media models) - once as a controller and once as dynamic actor?

Again, I'm apparently doing something wrong... (no code this time)

JTK

EDIT: Btw, you don't have getPhysicsResults() in neither one of the source files for your demos.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 6th May 2010 13:10
Yeh sure, I am putting some examples together for the next release so I will do a character controller example using that model you mention. I can't think of many situations were you would use a dynamic actor for a character, if the model has a 'fall down' animation this would usually be a better way to go.

Quote: "EDIT: Btw, you don't have getPhysicsResults() in neither one of the source files for your demos. "

Sorry about that, the last update changed it so you call these yourself, its slightly more work but it gives you more control, I will make sure all the examples are up to date for the next release.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 6th May 2010 16:33
Ok so I make her staic then? I'm placing her above some blocks and want her moving left/right based on ai control. Now gravity will make her fall onto the blocks, so doesn't she need to be dynamic to move left/right? Or a controller since she's ai based? I need interactions with the player too so the player can beat her up in the game... Lol

I figured dynamics was required. I guess I'm wrong...

When can we expect the next release?


JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 6th May 2010 16:40
All your characters should be character controllers, these are special dynamic-kinematic actors, because they are kinematic they are not affected by gravity or any forces, every loop move the controller down along the y-axis to simulate gravity, it will come to rest on the level geometry automatically.

It should not matter if your character is user controlled or ai controlled the principle is the same.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th May 2010 22:08
Pic of character controller example, she walks up stairs, ramps, falls of ledges etc.




As requested by JTK:


You will have to wait for the update for that version of FulcrumPhy::moveController() (I think!!) although the old version can work too.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 7th May 2010 23:04
Thank you, thank you. Now one more request if you would...

Attach the LevelMap.dbo file so I can use this code directly to investigate... LOL

JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th May 2010 23:10 Edited at: 7th May 2010 23:14
Here you go, I have not added the stairs in yet, will do that over the weekend. That level is more for testing the vehicles


EDIT:


Since you have older version you may need this.

Attachments

Login to view attachments
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 7th May 2010 23:13
Thanks. I have some running to do right now, but will play with it later...

JTK
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 7th May 2010 23:19 Edited at: 7th May 2010 23:20
Ugh, as you thought, moveController doesn't work... Please don't make me wait to long.

I'm gonna try using the other version that takes x,y,z parameters...

JTK

EDIT: LOL, you read my mind!
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 8th May 2010 03:09 Edited at: 8th May 2010 04:16
I'm sorry matty, but even the sample you provided isn't working for me. I guess I'm gonna have to give you a couple days to finish up with the update or give it up all together...

First, it was the myPhysics.positionCharacterController() giving me access violation errors. I commented that out and then it was the myPhysics.moveCharacterController() giving me an access violation.

Both of which was happening before the demo code (similar code btw). And both concerning the character controller; hmmm... Anyway, I guess I need to just wait for the update - but I can't wait long. Competition thread is waiting to see Capt. Ooze...

Guess I'll work on the AI stuff (or what I can of it) for now...


JTK

EDIT: DOH!!!! Next time before I give up on something, I'll spend more time researching my *own* code. As it turns out, I was specifying the wrong directories for the two files... My bad (again)... I'm liking the demo! Will report any findings (after I verify my own code is working properly -
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 8th May 2010 22:52
Ok Matty, one more thing (for now - ).

The code below is a modified version of your babe.x sample:



Now the purpose of this "test" is multi-fold:

1) Change her animation at will (MOVE/ATTACK). This is working somewhat flawlessly (SPACE_BAR)

2) Make sure the physics still applies to the new animation. This does not appear to be working. I assume it has something to do with the shape/size of the controller - but not quite sure - I use the swapObject() method to tell the controller which object it's working with.

Anyway, the problem I seem to be having is this:

Once the balls settle down (stop moving), I can't get the collisions to make them move again. I assume I can use the ApplyForce() methods to start moving them again, but how do I know which object to apply the force to? That is, which ball is she kicking? Or, when walking, which ball has she bumped into?

I don't see any way of garnering such information from the myPhysics class instance... Or is this not the way to achieve those results?


JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 9th May 2010 00:56
Hi, I have not done much testing with the swapObject() command, it does have a use and it does work but I don't think it will do what you are wanting it to do, it was not made for controllers.

One option you may have is to use the dbAppendObject() function, I'm not sure if this puts all animations into one object or splits animations to multiple objects lol.
A work-around would be to make another controller and just move the controller you are using, although hopefully the appendObject will work as this work-around is a little ugly.
If it turns out there is no solution I will look at the swapObject command for controllers.

When the balls come to rest they fall asleep to save CPU, physX has a wakeup command, I will put that in for the update, the update will also have contact reports and ray-casting, I'm sure these will help too.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 9th May 2010 01:22
The swapObject is working just fine for me... I had to setControllerDimensions() immediately after swapObject() to set the new controller size but as far as I can tell, it's working just fine.

Can you post the signature for the wake-up command and I'll just use that until the update? I don't want to have to download the entire SDK for one function... lol

Contact Reports and Ray-Casting are both what I'm needing, but I can work with what I've got so-far for a couple more days... Still on target for early this week?

JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 9th May 2010 02:45
Quote: "The swapObject is working just fine for me"

Really, cool

I'm not completely sure how the wake-up command works yet, I'll have to look into it, I think you can tell them not to fall asleep also.

As controllers are kinematic they will not wake up dynamic actors automatically, I think the raycast will work best for what you are doing, I have a function raycastFromController which will fire a ray out from your controller at the height you specify, you then could maybe apply a force in that direction.

I am not sure there will be an official update early this week but I can do a private update for you as you need the commands soon, I could just email you the new lib and header.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 9th May 2010 03:07 Edited at: 9th May 2010 03:08
Please do: TootieCollins2002 at Yahoo dot com. Thanks...

Question though:

I just *wasted* 3 1/2 hours writing an ID-Manager (again, based on TechLord's classes) to help interface your Fulcrum physics with my classes. I was thinking that Fulcrum physics requires an ID the same as the rest of the GDK.

My mistake there, but before I go *undo* all of that code, what's the likelyhood that you would require unique id's for the physics? I understand, and even knew before I started, that physics ID's automatically tie into the object's ID by default; but what about when such cases where they won't? What are the chances that in future versions, we may be required to assign an ID ourselves?

JTK
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 9th May 2010 15:17
Tricky one, everything generally shares the ID number, if you have already give the actors their own ID data then you may want to keep it like this, its hard for me to say.

I will always try to keep it so each actor shares the ID number of the object, this is why the ground plane actor does not have an ID number.

I'll try and have that Lib ready tonight.

Login to post a reply

Server time is: 2024-04-24 17:04:06
Your offset time is: 2024-04-24 17:04:06