Mouse GameObject Go Throw Wall

Hello Everyone

i have GameObject [Torus] Follow The Mouse

     var mousePos = Input.mousePosition;

     var wantedPos = Camera.main.ScreenToWorldPoint (Vector3 (mousePos.x, mousePos.y, 10));

     transform.position = wantedPos;

The Problem That When i The Mouse Be Inside Another GameObject The Torus Disappear

I Cant Explain It With My Bad English

lemme Show You Picture

alt text

alt text

as you can see the picture

when i move the Torus it can go throw wall,

i dont need that

i want it to flip 90 degree Just Like Posting On Wall

Just Like Magnetic ,

//EDIT : I Tried To Make

  transform.Rotate(90, 90, 0);

but the problem that Gameobject still Move Throw Wall [ I Added Collider]

it will be good if i just find way to not let the gameobject go throw the walls

1 Answer

1

you should make invisible wall front on your wall then add OnTriggerEnter function to rotate object like wall rotation and also customize rotation now i think you know about ontriggerenter function if need more help kindly put comment i will guide you more about this .
i hope this is helpful to you , :slight_smile:

yes guide me more please because i want to make vertical Aim in Top-Down Game

–