Lerpz scripting questions

I have been playing around with the 3D lerpz turorial to learn Unity, however I have a few questions at the moment (and I am sure I will have a “few” more as time progresses…).

  1. I have added a floating platform to the game (from the “Build your own” folder), and then added a rotation script to it so that it rotated in the y axis. When playing the game I have Lerpz jump onto the platform, the platform is spinning yet he just stays in the same place. How can I get him to follow the same rotation of the platform?

  2. How can I make the surface “slippery” based on slope steepness. As he approaches the round roof edges, I would like him to slide off, or at least start to slide in the direction of the slope if not corrected by the user, all depending on how close he is to the edge, or its slope angle to his. Any hint on an approach to this would be great!

Sorry if these are painfully obvious to the old timers here, but I am trying to get my head around the scripting concepts and Unity API. I have tried to search the forums, but honestly I don’t know what to search for.

thanks in advance.

Rice

You could add some code to the third person controller scripts so that when grounded you can see if the player is on a spinning platform and if so, make Lerpz a child of that platform object (and thus rotate). Jumping (and therefore becoming un-grounded) should then break that parent-child relationship and stop the spinning.

Again, add some code when the player is grounded to look for the slope of the surface underneath him and apply a “downhill” force might work. You can use raycasting to get the mesh face underneath the character and from there determine its slope and calculate your downhill force vector to apply.

Are you with me conceptually? If so then check out the third person controller scripts and be sure you’re comfortable with how they work, then look at adding code to it:

  1. Look up Transform.parent so you can make/break a parent-child relationship between Lerpz and your spinning platforms.

  2. Look up Physics.Raycast and RaycastHit for checking the slope of the surface below the character.