How to properly get the device's forward vector?
angecroft
Posts: 2
Hi! I'd like to apply a force on an object based on the camera forward (I use Device Tracking Surface mode). But I keep getting weird results where the object is going into the camera and not straight where the camera is looking at. Here's my snippet code at the moment:
var camera = script.getSceneObject().getParent(); var camForward = camera.getTransform().forward; var dirForce = vec3.up().add(camForward).normalize(); physicsBody.addForce(dirForce.uniformScale(1000), Physics.ForceMode.Impulse);
0