I use vehicle.js to control my car,but ,I am not pleased with the effect of the Collision;so I want to do some function in the collider event ;
normally,i use event of CollisionComponent,like this:
this.entity.collision.on(“collisionStart” ,myfunction())
Now,there is no CollisionComponent to use for me !
so,how can i use collision event???
thank you !
I’m from china…
It’s a bit difficult to tell without seeing the entity setup. If the car has physics, it should have a collision component on it somewhere. You will need to access it and listen for the events on it.
Adjust .js is not useful ,so ,you don’t have a care on it;
I want to use collide event in my scripts, example :in my MyVehicle.js, to use a event ,OncolliderStart ;
The shape of Collision is not usefor,because I use Ammo.js to create shape instread of collisioncomponent
I hope that the car get a stronger collisiion from the barrier ,I hope that after the car hit from the barrier,it can be flick far away.
so I want to give the car a stronger impluse force
I want to get the point of the hit on the wall from the collider event;
As you can see,in my MyVehicle.js , I use Ammo.js to create the shape, not use the type of collisioncomponent
Ammo.js is the C++ Bullet physics library compiled into JS so the documentation for it is hard to find. It involves going through the documentation of Bullet and finding out what is exposed in Ammo.js.
Please note that Ammo.js is not a PlayCanvas library so if you are looking for support, you will have to ask on their GitHub page here https://github.com/kripken/ammo.js/
I just want to learn the API in Ammo.js,for example: this.vehicle.getRigidBody().setAngularFactor(ammoVec);
this.vehicle.getRigidBody().setLinearFactor() …
[quote=“z281159443, post:17, topic:9359, full:true”]
I just want to learn the API in Ammo.js,for example: this.vehicle.getRigidBody().setAngularFactor(ammoVec);
this.vehicle.getRigidBody().setLinearFactor() …