Quantcast
Channel: Answers by "podmaster"
Viewing all articles
Browse latest Browse all 30

Answer by podmaster

$
0
0
Hi , i know that the first person controller from unity standard assets has that functionality i dont really know how it works. But you can create an OnTriggerStay2D to get the velocity of the plataform. function OnTriggerStay2D(PlatformCollider : Collider2D){ if(PlatformCollider.tag == "Plataform"){ var platformVelocity = PlatformCollider.GetComponent(Rigidbody2D).velocity.x; rigidbody2D.velocity.x = platformVelocity; } } For this to work your platform and player should have rigidbody2D and the platform must be moved by addForce or Velocity and not by transforming or animating the position. **EDIT** Remember to use 2D Colliders and 2D RigidBodies , and to set your player Collider to "IsTrigger" you should add 2 2D Colliders to your player one for the trigger events and other for collisions. I left you the test project i made. press left or right to move the plataform and press jump (space bar) to move the "player" to the right. http://www.mediafire.com/download/132ilw84vpc5ps9/plataformTest.zip

Viewing all articles
Browse latest Browse all 30

Trending Articles



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