About Store Forum Documentation Contact
Donations:
167$/mo



Post Reply 
[Solved]Car collision with chars
Author Message
xenno Offline
Member

Post: #1
[Solved]Car collision with chars
Hi, long time without play with Esenthel engine (only when i have spare time wink)
Today i come with a little car test where i will be able to drive arround and ... well, do you remember Carmagedon? XD

For my test, i use a convex phis for simulate actors ragdoll when they crash over my car. My problem come when i need to know if some actor has impact the car.
I tried several things, but i can get the result i want to have.

I supose that i need some "box" arround my car wich will take contacts with chars and enable animations or ragdolls, but every thing i tried fail u.u

I've tried a box arround car and test cuts or sweep, but don't get nothing.
I've tried a OBox ann test Physics.cut, but didn't work.
I've tried objGet() but no OBox supported.
And some things more that i don't remember XD

Suggestions?

Thanks ^.^

EDIT : I changed the title for easy search if someone need to do similar task smile
(This post was last modified: 08-15-2010 11:12 AM by xenno.)
08-14-2010 11:28 AM
Find all posts by this user Quote this message in a reply
Arikin Offline
Member

Post: #2
RE: Objects arround me
Maybe Bloody Massacre codes (bullet's exactly) could help you.
08-14-2010 12:53 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Objects arround me
Game::World.objGet gets you a list of objects which their Game::Obj::pos is located inside the specified shape

maybe you can use Physics.cuts(OBox, with callback)
inside callback iterate all encountered actors.

You can also use Physics.reportTrigger, or at last resort Physics.modifyContact
08-14-2010 01:37 PM
Find all posts by this user Quote this message in a reply
xenno Offline
Member

Post: #4
RE: Objects arround me
Just what i always hope in esenthel support. Quick and usefull help.
I didn't noticed that cuts can accept callback ( to be honest, i needed to search for what callback was pfft )

Now i get what i want.

Thanks Esenthel for give me the trick
Thanks Arikin for remember me that exist Bloody Massacre.


And, as allways a bit of code XD
Code:
struct MyPhysCutsCallback : PhysCutsCallback // Physical Cuts Test Callback
{
   virtual Bool hit(Int group, Ptr user, Game::Obj *obj)
   {
       if (obj)
           if(Game::Chr *chr=CAST(Game::Chr,obj))
            {
                chr->ragdollEnable ();
            }
       return true;
   }
}HitInfo;

In update func
Physics.cuts(TestCollisionShape,HitInfo);

As in additional question. When i try to draw my OBox for debug test. When i move the camera, in some moments my box is draw in other place. Any idea? XD

Some funny test images lol ( EDIT : Thank to Zervox, i can see now smile )
[Image: test0.jpg]
[Image: test1t.jpg]
[Image: test2pg.jpg]
[Image: test3p.jpg]
(This post was last modified: 08-15-2010 11:02 AM by xenno.)
08-14-2010 03:41 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Objects arround me
Quote:As in additional question. When i try to draw my OBox for debug test. When i move the camera, in some moments my box is draw in other place. Any idea? XD
perhaps you need to reset drawing matrix first, SetMatrix();

yeah, I cant see the images, maybe re-uploading would help wink
08-15-2010 09:42 AM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #6
RE: Objects arround me
He have to use the public/direct link imageshack gives after upload
[Image: test0.jpg]
[Image: test1t.jpg]
[Image: test2pg.jpg]
[Image: test3p.jpg]
(This post was last modified: 08-15-2010 10:17 AM by Zervox.)
08-15-2010 10:10 AM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #7
RE: Objects arround me
Looks really great smile
08-15-2010 10:33 AM
Visit this user's website Find all posts by this user Quote this message in a reply
xenno Offline
Member

Post: #8
RE: Objects arround me
Yeah, i needed to reset matrix first and my testbox is drawn perfect (my new thing learned today lol )

Thanks Zervox , i always fail when try to post images in forums grin

Thanks Harry, it's a simple test but it's funny get ideas come quickly reality.

I never finish my proyects because i'm not programmer and ... well, i work in construction sector and that is my hobbie but i learn a lot in this community and Esenthel Engine is very easy to use.

Next task ... try to move characters through a simple path and avoid to be run over ( run over? google translator, sorry smile )
(This post was last modified: 08-15-2010 10:56 AM by xenno.)
08-15-2010 10:56 AM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #9
RE: [Solved]Car collision with chars
run over is correct ; ) that needs some sort of steering I believe.
08-15-2010 12:10 PM
Find all posts by this user Quote this message in a reply
xenno Offline
Member

Post: #10
RE: [Solved]Car collision with chars
smile
For now my car work ok, but it's far to be good. Some time, when i have 3 chars over the car, it tends to break.
I need to adjust some phisics values or trick them. Also need to work much more in my car class. I tried to get values for make it like GTA4 cars and so, but it's seems that wheels can't reach this results easy. I think i will need to change lots of values depending on speed.

But i don't want to think about it right now because i think will be a hard work xD
Of course, i'm working also in my car editor pfft
(This post was last modified: 08-15-2010 04:25 PM by xenno.)
08-15-2010 04:24 PM
Find all posts by this user Quote this message in a reply
xenno Offline
Member

Post: #11
RE: [Solved]Car collision with chars
Well, my car can kill characters, and they avoid me when try to run over them. To be honest i've only calculated a simple vector oposite to car movement (easy kill) and perpendicular (hard =ยบ)
Now i see that my collisions seems to be poor acurate, because character actor ( capsule ) go too far from real body and i want to check aditional info in contacts so i want to use character's ragdoll as info for contacts supply.
I tried to figure out how to do this for several days (20 for now XD). I assign group id for ragdolls bones, and well , it's dificult to remember all i did.
My own logic claim to be something like:
Check contact with character Capsule, if exist, check for all raggdoll's bones contacts, but i can't get it work =/

Any help? Thanks ^.^

[EDITED]
Ok, finaly back to home, since my boss tell us that we must finish the floor today. Yai my shoulders XD

Well, that was i think about

Code:
struct CarCollision : PhysCutsCallback // Physical Cuts Test Callback
{
   virtual Bool hit(Int group, Ptr user, Game::Obj *obj)
   {    
       if (obj)
       {
            //Maybe group would be the best choice, but for test it's fine XD
            if(Game::Chr *chr=CAST(Game::Chr,obj))
            {
                for(int i = 0; i < chr->ragdoll.bones() ; i++)
                {
                    //some thing like that?
                    chr->ragdoll.bone(i).actor.cuts(...);    //Check collision with all bones's actor?
                }
                //chr->ragdollEnable();
            }
       }
       return false;
   }
}CarCollisionInfo;
Ok, that was my idea. A little bit brute? XD
I try to know if
Code:
Physics.cuts(TestCollisionShape,CarCollisionInfo);
iterate through all contacts, but seems to react only to first one? Character's actor in this case :S
I'm confused, some trick?
(This post was last modified: 09-13-2010 08:22 PM by xenno.)
09-13-2010 08:21 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #12
RE: [Solved]Car collision with chars
I don't know if it will fix your problem but in the Physics class you have damping functions:

- Flt damping ();
- Flt adamping ();

There is always evil somewhere, you just have to look for it properly.
09-14-2010 11:41 AM
Visit this user's website Find all posts by this user Quote this message in a reply
PRG3D Offline
Member

Post: #13
RE: [Solved]Car collision with chars
Hi xenno,

Did you solve the problem? Can you show me a parat of source responsible for collision with chr?
01-27-2011 05:14 AM
Find all posts by this user Quote this message in a reply
Post Reply