[SOLVED] Vehicle Physics - Detect head touches to the ground?

Hello,
How i can detect Head touches to the ground?
image

I added spear model and collision on hitHead
image

But CarPhysics have compound collision where it turn every child’s collision into rigidbody. So as you can see the hitHead entity also linked with it.

===
I just simply want to check spear touches to the ground…
How i can do this?

Thanks

I would use a trigger volume to represent the head.

1 Like

@yaustar Do you mean this?
https://developer.playcanvas.com/en/user-manual/physics/trigger-volumes/

I try this but it does not work

// init...
this.headPartEntity.collision.on('triggerenter', this.onCollisionHeadStart, this);

// call...
VehicleControls.prototype.onCollisionHeadStart = function () {
    
    console.log("headshot");
    
};

===============

And according to doc…

Do not add a rigidbody component to your trigger volume entity.

So I think of this…

What you say? :thinking:
Any other way to solve it?

You add another entity that is a child of the vehicle for the trigger to represent the head.

1 Like

Do you mean this?

Please correct me if i am not getting… :roll_eyes:

Edit:
@yaustar I am sorry but i think i didn’t get it…

Please anyone can help? anyone?

Hello @Ketan_ATA! What is your result so far?

1 Like

Hello @Albertos, Glad you asked… :slightly_smiling_face:

After some experiments, As i come to know that there is no direct solution for this question…
So jumped out of box…

I mean this way
image

I placed hitHead (collision - triggerenter) outside of CarPhysics.

In update i did this…

this.hitHeadEntity.setPosition(this.headEntity.getPosition());

image
So problem is solved… :slight_smile:

Thanks for help @yaustar, @Albertos

Great! I also learned something, because to understand your problem I had to delve into the ‘compound collision type’. Thanks.

1 Like