c# - UNITY 3D - Camera perspective shows objects moving the wrong way -


while following guides make object move, have issue.

so, objects on scene 0, 0, 0, on rotation except camera. camera, 0, 180, 0. script says - object move left :

void update () {     transform.translate(vector3.left * (scrollspeed * time.deltatime));//access transform component , moves left 20 times frame rate } 

so technically moves left, camera perspective @ 180 degrees @ game front. solution rotate platform on y match perspective make in reverse when working on things dont have keep using negative numbers opposite of actual scene?

instead of using vector3 static variables define in world space, can use transform of camera, moving directions depending on camera. in case:

void update () {     transform.translate(     -camera.main.transform.right * (scrollspeed * time.deltatime)); } 

notice - in front of camera.main.transform.right, opposite of right direction left direction ;-)

if have several cameras in scene, use reference camera want instead of camera.main


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -