x


Character falling through moving elevator - SOLVED

This has been asked before, but the threads Ive read didnt seem to get a satisfactory resolution..

So I post my version.. now with added video!

https://vimeo.com/46711636

So I made this game to day with my kid on my knee (all his ideas and he designed the cardboard robot) but I ran into a problem...

Why does he fall through the magical egg-cup? Robotti is using the standard controller, with Rigid body attached, and the eggcup has a mesh collider (also tried a simple box collider) and also a rigid body... There are some numerous settings for rigid body, but what is correct? Please help?

Mark

more ▼

asked Jul 31 '12 at 08:56 PM

markfrancombe gravatar image

markfrancombe
120 9 15 18

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

1 answer: sort voted first

hallo, I use this, found somewhere here, on a trigger inside the lift

var platform : Transform;
var player : Transform;

function OnTriggerEnter () {
   player.parent = platform;
}

and this on a trigger just when exit the lift

var platform : Transform;
var player : Transform;


function OnTriggerEnter () {
  player.transform.parent = null;

}

using OnTrigerExit on the trigger is in the lift don't know why, but don't work

more ▼

answered Jul 31 '12 at 09:28 PM

Ingen gravatar image

Ingen
145 3 11 19

Wow!! This very nearly worked Thanks!!! The first script worked like a charm, I just flung it on the eggcup and now Robotti the cardboard robot went sailing up, no problem. BUT...

Im afraid when he jumps off at the top, I apply the second script to that patform, but the lift seems to pull him back down and through that geometry.

Im assuming that script one is temporarily parenting the player to the platform, so Im not managing to remove the parent it seems.

Just to clarify, when you say trigger, do you attatch it to a collider that has Is Trigger turned on, of just a regular collidor.

The lift collider works just fine without trigger turned on... But the top platform does not...

Mark

Jul 31 '12 at 10:05 PM markfrancombe

this comment may not be relevant but you need to have a rigid body with kinematic enabled for it to react to physics properly.

Jul 31 '12 at 10:23 PM reptilebeats

I use a empty gamobject with box collider as trigger, childed to plane of lift tho reuse

the second is just forward the door of lift if you don't have something to walk, maybe could surround the cup with some box

or if don't need reuse the cup to go down, just put the second trigger at the point you need to junp away, just a bit up the robot, so that is reached when jump

Jul 31 '12 at 10:24 PM Ingen

Nice idea Ingen...you are right.. the robot must jump out of the cup Ill give it a try...

One thing tho, just to check and see if it was working, I added a debug thingy...

var platform : Transform; var player : Transform;

function OnTriggerEnter () { player.parent = platform; Debug.Log("Im on a lift"); }

And noticed that console returned "Im on a lift" as soon as the level loads, NOT when Robotti jumps into the eggcup... is this an error?

MArk

Jul 31 '12 at 11:05 PM markfrancombe

I think yes, can Robotti move normally? It's anyway strange

but I never use debug because you can see lift , the cup in your case, is parented to player, directly in the inspector - how much the trigger is big?
- Is on top of the cup, and big as the cup? - then is player misses the jump isn't parented

Jul 31 '12 at 11:38 PM Ingen
(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:

x32

asked: Jul 31 '12 at 08:56 PM

Seen: 447 times

Last Updated: Aug 03 '12 at 10:22 PM