Thursday, July 21, 2022
HomeGame DevelopmentMaking a rigidbody drive at world level - Cocos Creator

Making a rigidbody drive at world level – Cocos Creator


Hello All,

I’m just a little confused by applyForce on rigidbody. The docs says it wants a drive Vec3 and a relativePoint Vec3. I’m presuming the relativePoint is the place to use the drive from. What I don’t perceive is what the drive Vec3 needs to be? I’m additionally confused in how this works as if I do applyForce(new Vec3(10,10,10)) after which tried applyForce(new Vec3(10,10,10), vectorOfANode.node.getPosition)) and the node strikes. The drive acts the identical as not supplying a realtivePoint and if the course of the node adjustments the course of the drive doesn’t.

Can’t appear to grasp how that is working. If anybody can clarify and provides so examples it could be an enormous assist in attempting to grasp this.

Thanks,
-iDev


So technically. The under is giving me just about the outcomes I’d anticipate. Though on a special mannequin, may not work the identical.

consequence.collider.node.getComponent(RigidBody).applyLocalImpulse(new Vec3(-result.hitNormal.x+drive,consequence.hitNormal.y+drive,consequence.hitNormal.z+drive), consequence.hitPoint);

If anybody has a greater suggestion, I’d have an interest to know.

Thanks

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments