Hello Devs,
I have rectangular rigidbody A and I want to apply linear impulse to a point on this body. Now, applyLinearImpulse takes three arguments. An impulse vector, world position and wake up boolean. The second argument world position is confusing for me. What I understood is that I need to give body point in world space and that’s what I did but as a result, I am getting linear velocity but not angular velocity when I am applying impulse at corners. here’s my code…
this.node.on(cc.Node.EventType.MOUSE_DOWN,(event:cc.Event.EventTouch)=>{
self.mouseStart = event.getLocation();
let localPoint = self.node.convertToNodeSpaceAR(self.mouseStart);
localPoint.x = localPoint.x/(self.node.width / 2.0);
localPoint.y = localPoint.y/(self.node.height / 2.0);
self.impulsePoint = self.rb.getWorldPoint(localPoint,localPoint);
},this,false);
after this I just call self.rb.applyLinearImpulse(swipeDirectionwithMagnitude,self.impulsePoint,true)
but Its just moving not rotating when applied force on corners. Please help. thanks.