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 / Handling Animation with Sparky collision

Author
Message
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 26th Apr 2008 06:41
Sparky\'s doesn\'t seem to support handling of animated objects... I thought I could fix it with Limb to object collision but I can\'t find that either... Anyone know of a way to do animated objects and/or limb collision with Sparky\'s... If not, please do say it\'s impossible if it is...

I also know of Tobi453\'s collision detection but I\'m having trouble figuring out how to use it... Any help on that might be cool too...

~~It's not who you are underneath, but what you do that defines you.~~
tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 26th Apr 2008 12:54 Edited at: 26th Apr 2008 12:59
hi core2uu,

it isn't that difficult, if you have some knowledge of c++:

first of all you must include the headerfile.

//declare a pointer to the collision.The "*" tells the compiler that the variable is a pointer.
OpenSourceCollision:: ObjectCollisionClass* Variable;

//now you initialize the collision / if you have trouble with the new operator look here
Variable=new OpenSourceCollision:: ObjectCollisionClass(ObjectNumber);

Important: If you overwrite the collision pointer you lose access to the collision. if you want do delete the collision from memory, write:
delete Variable;

now somwhere in you mainloop you must call:
Variable->Update();

if you want to call the collision, write:
Variable->Intersect(D3DXVECTOR3(x1,y1,z1),D3DXVECTOR3(x2,y2,z2));

otherwise you can also create a start and end point
D3DXVECTOR3 startpoint=D3DXVECTOR3(x,y,z);
D3DXVECTOR3 endpoint=D3DXVECTOR3(x,y,z);

and then you can write:
float d=Variable->Intersect(startpoint, endpoint);

D3DXVECTOR3 is class/struct that comes with directx and is declared in d3dx9math.h. it has many useful constructors.

you should also check whether you object has bones/vertexmanipulation. in this case the collision won't work.

FINAL VERSION RELEASED!!!!
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 26th Apr 2008 20:23
If I wanted to detect a collision between object1 and object2, what would I put in place of x1,x2,y1,y2,z1,z2?

That was the part I was having trouble with...

~~It's not who you are underneath, but what you do that defines you.~~
tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 26th Apr 2008 20:47
intersectobject does not detect collision between objects, it does check whether a line defined by a start- and endpoint intersects with an object. this is useful for bullet collisions.

sorry, but at the moment it isn't possible to detect whether two objects collide, so you must use the dgdk commands.

I use intersect object for all collisions but that is a more complex matter.

FINAL VERSION RELEASED!!!!
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 26th Apr 2008 20:58 Edited at: 26th Apr 2008 20:59
I thought it was possible to do manual polygon collision detection with intersect object... Actually with dbIntersectObject I had a somewhat working collision system... It only detected collisions about half the time maybe cuz I set it up wrong...

So is it truly not possible at all to do polygon collision detection with animated objects with ANYTHING that exists?

~~It's not who you are underneath, but what you do that defines you.~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Apr 2008 19:18
That's NOT true... Though Toby Said his collision system doesn't work on BONES animated stuff... but mesh manipulated animation I guess it does.

Also, depends how you animate... I mean, I'm PRETTY SURE Sparky catches limbs that have moved if you update the model. Could be wrong. Those though are static "meshes" just rotated... not animation per say.

Um, Intersect Object I think works kinda like Tobi's , his isjust faster I think than Intersect. (He uses the DirectX API directly somehow... haven't had a chance to look into it yet)

tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 28th Apr 2008 22:14
hi jason,

I use dbLockVertexDataForLimb and create a copy of the object vertex data in system memory . Every limb is rotated by a matrix. you can access this matrix:

first get the object pointer:
sObject* pObject=dbGetObject(ObjectNumber);

then get the matrix:
D3DXMATRIX limbmatrix=pObject->ppFrameList[LimbNumber]->matAbsoluteWorld;

now there are two ways: Either you rotate the whole limb data using the limb matrix or you calculate the inverse matrix and rotate the start and endpoint of the intersection into the local limb coordinates. I prefer the second way.

the second way works with any limb matrix as long as the matrix can be inverted. therefore the determinant must be non-zero. further more scaling and animation is taking automatically into account.

Btw, are you interested in getting the UV-data of the collision point? This requires little reprogramming and then it should be possible that you can shoot through the transparent parts of an object.

Moreover I noticed today that with limb collision it is possible to code headshots... Definitely a feature for my new game.

FINAL VERSION RELEASED!!!!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Apr 2008 22:35
Quote: "Btw, are you interested in getting the UV-data of the collision point? This requires little reprogramming and then it should be possible that you can shoot through the transparent parts of an object."


Not only am I "Interested" I VERY much want to incorporate your collision code into my DarkGDK OOP Library. (Especially with ability to shoot through transparency... Especially if programmable like... if ALPHA < SOMEAMOUNT THEN GO THROUGH IT.... this way .. light "Brush/Foliage" bullet could go through, Darker Foliage Could "Skew" the Shot, and Solid Stuff could be a richochet or absorbed ... bullet In Tree or Richochet? (Random works LOL )

You definately understand this area of 3d stuff VERY WELL! I can learn from you on that... inverted, not.. bah... don't get it yet. Hopefully when I peruse your code.. you did release your code I thought.. I need to grab it... don't think I did yet... <grrrr> Really want to scope it out.

Head Shots, Limb collision... this a TOBI thing or a DarkGDK thing? Sounds AWESOME!

There is a game called ArmA (Armed Assault) I bought it - its like a WAY ADVANCED Battlefield 1942 (which is about where Iron Infantry will hopefully sorta be like) but its to Powerful for my PC, and frankly... Is TOO REAL in some ways... TO MANY things you can do makes it so you practically need to REPROGRAM fifty key strokes to make usuable and a manual an inch thick on hand.. I want Iron infantry to be a "Fun" yet simple... ANYWAYS..I digress... ArmA has it where if you get shot in leg.. you run WAY messed up... depends on damage.. you limp... arm... stuck on what you can shoot ... 2 handed gun more difficult if hand blown off.. etc.

Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 29th Apr 2008 01:33 Edited at: 29th Apr 2008 01:58
Quote: "I'm PRETTY SURE Sparky catches limbs that have moved if you update the model. Could be wrong. Those though are static "meshes" just rotated... not animation per say."


Sparky does catches limbs that have moved but that is different than animation as you said in your post... Sparky's can't detect animation...

That being said is there way for me to collision detection with animated objects? I could try dbIntersect or Tobi's but do they work on animated objects?

Quote: "The reason I programmed this, was that I was really annoyed by the fact that dbintersectobject is slow and works with animated objects and sparky is fast and doesn't work with animated objects."


I remember you did say this in your post where you posted your collision source tobi...

~~It's not who you are underneath, but what you do that defines you.~~
tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 29th Apr 2008 16:15
hi core2uu,

it works with animated objects (I use it with animated objects in my game), but there should be no bones in your object. if there are bones in your object, the vertices of a face can be applied to different limbs and that is the problem.
Unfortunately nearly all human models do have bones.

It should be possible to make it work with bone-animation, but this requires more work and I don't understand completely how bone animation works.

FINAL VERSION RELEASED!!!!
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 30th Apr 2008 02:03
Well thanks for trying anyways Tobi... Since I didn't model the two models I use I don't know if they have bones although I'm pretty sure they do... For now I think my hybrid DGDK-Sparky collision system will work well enoguh...

Well thanks...

~~It's not who you are underneath, but what you do that defines you.~~

Login to post a reply

Server time is: 2024-11-20 09:40:26
Your offset time is: 2024-11-20 09:40:26