Jump to content

Elevator up direction falling thought mesh


Recommended Posts


I got a 3dModel of an elevator. I trigger a button for it's position with the following code: 

myMesh.actionManager.registerAction(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.OnPickTrigger, myMesh,"position.y",-2.6, 1000)) //down
.then(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.OnPickTrigger, myMesh,"position.y",0.001, 1000)); //up

Witch works great!

Accept when my char wants to get up again, he is falling through the ground, - the mesh.
Few workarounds that come into my head, like check the state of the "event" an apply new gravity or new cam position.

What's the easiest one?

Any suggestions are highly appreciated! 


Link to comment
Share on other sites

@Nabroski-Hi Nabroski.

Very interesting playground. But neither the up movement nor the down movement is working right I think. At least in this playground. It seems that the camera does not update its collision status.

I think you have to use the "moveWithCollisions()" call to update the position. Maybe these links could help: 

http://playground.babylonjs.com/#1NQTNE#11 and the corresponding thread here:

Another opportunity is to move the cam (=your character) synced with the elevator. Like this:

scene.registerBeforeRender(function () {
	if (xDown) {
		elevator.position.y -= 0.01;
		camera.position.y -= 0.01;

Here is a quick and dirty example: http://playground.babylonjs.com/#21GEQY

Of course you need to implement some more checks to know whether your cam is in the elevator right now and when to stop and so on. I think this is the easiest way in your case.

Maybe you could use the physics engine with cannon or oimo. But this could be oversized.

I'm still new to babylon, sorry if I'm misleading and correct me if I'm telling crap ;-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...