I am trying to apply a random force to a rigidbody with applyImpulse() but it does not seem to work.
I log the vectors and I have tried scaling them as well.
I have tried relaunching unity and the server just in case but still have the same issue.
Any help is appreciated, Thanks!
Original Post on Discord
by user 313149111853645827
I have updated the code to be similar to the sample and I still seem to have the same issue, it looks like the rigidbody velocity is never updated.
by user 313149111853645827
I just tried with another script which works just fine 
import { Behaviour, GameObject, Rigidbody, serializable } from "@needle-tools/engine";
import { Vector3 } from "three";
export class PhysicsImpulse extends Behaviour {
@serializable(Rigidbody)
rb: Rigidbody | undefined;
update(): void {
if (Math.random() < .05 && this.rb) {
this.rb.applyImpulse(new Vector3(0, Math.random() * 1, 0));
console.log(this.rb.getVelocity());
}
}
}
Added this to an object in the basic physics sample scene
Yep, that script works! Impulse seems to only work when called in update. I was trying on call it from collision enter.
I am sure it was in the documentation somewhere but I missed it.
Thanks!
by user 313149111853645827
Ah I see!! No actually I wasnt aware of that. But it makes sense. Will add it to my todos to look into it