Question by
darkbisop · Oct 01, 2021 at 07:03 PM ·
unity5camera rotateaugmented reality
AR Foundation - How can I move the object in the direction the camera sees it?,
I put in a direction button, and I want to track an image with AR, create an object, and move the object toward the place I currently see with the camera. But I object when turning the camera somewhere else, I see the same direction and must be moved. But there's a completely wrong movement. I need advice on how to do it.
public Camera arCamera; <-- This is ARCamera
void MoveUp() { Vector3 dir = arCamera.transform.rotation Vector3.forward; Object.transform.Translate(dir speed * Time.deltaTime ); }
public void MoveDown()
{
Vector3 dir = arCamera.transform.rotation * Vector3.back;
Object.transform.Translate(dir * speed * Time.deltaTime );
},
Comment
Your answer
Follow this Question
Related Questions
EasyAR object jitters 2 Answers
Augmented Reality and GPS 0 Answers
AR Game Crashes after launch (AR Foundation/Android) 0 Answers
Camera Roll/Headbob? 0 Answers