Quantcast
Channel: Questions in topic: "portals"
Viewing all articles
Browse latest Browse all 85

Portal issue and transform.position

$
0
0
I'm trying to make a portal on which if my player enters, he gets transported to a certain position elsewhere. Right now I'm using the following logic. if(tile.tag=="portal") { int x = System.Convert.ToInt32(portaldest.transform.position.x); int y = System.Convert.ToInt32(portaldest.transform.position.y+1); int z = System.Convert.ToInt32(portaldest.transform.position.z); player.transform.position = new Vector3 (x,y,z); print (player.transform.position); } This logic seems to be correct, and should work perfectly. The issue I'm getting here is, say my portal destination is the spot (0,0,-3), the player gets moved to a different position which is (0, 0, 3.4) which shouldn't happen. As I even made the position to be an int position. edit: When printing, it shows the position as (0.0,0.0,3.0) so it should be working. :/ edit2: Just some things you might want to know. The player is a rigid body, use gravity is on, freeze x and z are on. Collision detection is continuous. If I remove the freeze on x and z I can't enter the portal, and if I remove gravity, it's y axis increases to infinity after entering the portal.

Viewing all articles
Browse latest Browse all 85

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>