x


How to compensate for moving platforms that move side to side

Question 694

I followed the exact way that was described in the link. It works great with vertical moving platforms. However, when I got my character to a platform that was moving side to side, the character didn't move with the platform. Is their a way to compensate for this?

more ▼

asked May 20 '10 at 07:02 PM

Helpmepls123 gravatar image

Helpmepls123
37 4 4 9

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

I got the simplest solution for this problem from another forum.

So basically, you create another object with collider on top of your normal platform, and parent it to your platform.

Apply this script to your collider object, and it should work.

function OnTriggerEnter (other : Collider) { other.transform.parent = gameObject.transform; } function OnTriggerExit (other : Collider) { other.transform.parent = null; }

more ▼

answered May 21 '10 at 01:18 AM

Deo gravatar image

Deo
1

Sorry for the late response, but I tried that and it just makes my character fall through the platform.

May 27 '10 at 07:08 PM Helpmepls123

Ok I did something wrong. It works now but the problem I have is that when my player turns around, he just randomly disappears and the Character Controller keeps changing in size. What's going on?

Jun 02 '10 at 06:47 PM Helpmepls123
(comments are locked)
10|3000 characters needed characters left

Create an empty GameObject. Add a mesh collider in the shape of your platform, and make it a trigger. Then make it a child of your platform/elevator (it works for both), and raise it so it is just a little higher then the platform itself. Then attach this script to the trigger you made:

var Player : Transform; 
var Elevator : Transform; 

function OnTriggerEnter (other : Collider) {
Player.parent = Elevator; 
}

function OnTriggerExit (other : Collider) {
transform.DetachChildren();
}

Make the trigger GameObject in the Elevator slot and your player in the Player slot. When your player gets on the moving platform, he/she will not slide off and will move with the platform perfectly in any direction.

more ▼

answered Sep 27 '10 at 09:33 PM

jamesster gravatar image

jamesster
66 7 8 12

my question was the same, and i tried this answer, but! my character moves with the platform (i have rotating platforms) even when in the air!!! any ideas?

Oct 25 '10 at 09:03 AM angad singh

I'm having the same issue and it didn't work at all. The player still slides off. I've tried many methods. Putting a CharacterController on it and messed with some methods that included that, messed with the Trigger method, and different versions of the parenting method. Nothing's working.

Dec 06 '10 at 03:57 PM dre38w

Just to make sure I wasn't too confusing when I said "it", the CharacterController was put on the player not the platform.

Dec 06 '10 at 04:01 PM dre38w

I'm also having this issue. It's a real pain and cannot figure out how to make this smooth connection between moving platforms and the player.

Oct 12 '12 at 02:03 AM Sinron
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x221
x206
x37
x37

asked: May 20 '10 at 07:02 PM

Seen: 1850 times

Last Updated: Oct 12 '12 at 02:03 AM