Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
How do I make platforms which follow a path (it goes up and down) and allow the character to stand on it and you can travel up with it? It doesn't work... |
||||
|
currently that is not supported right out of the box. gotta program it, unfortunately! |
||||
|
Ah, darn it. Hmm.... What a shame! I'll have to modify the level a bit to get around this (sad) limitation I suppose... |
||||
|
Add collision and the behavior below, it's the behavior from the documentation. It works only with two path points. /* <behavior jsname="behavior_moveBetweenPoints" description="Move scene node between 2 points"> <property name="EndPoint" type="vect3d" default="100.0, 100.0, 100.0" /> <property name="Speed" type="float" default="0.02" /> </behavior> */ behavior_moveBetweenPoints = function() { this.LastTime = null; this.StartPoint = null; }; // called every frame. // 'node' is the scene node where this behavior is attached to. // 'timeMs' the current time in milliseconds of the scene. // Returns 'true' if something changed, and 'false' if not. behavior_moveBetweenPoints.prototype.onAnimate = function(node, timeMs) { // get the time since the last frame if (this.LastTime == null) { // we were never called before, so store the time and cancel this.LastTime = timeMs; this.StartPoint = ccbGetSceneNodeProperty(node, 'Position'); return false; } var delta = timeMs - this.LastTime; this.LastTime = timeMs; if (delta > 200) delta = 200; // never do movements longer than 200 ms // move var pos = ccbGetSceneNodeProperty(node, 'Position'); var movementVector = this.EndPoint.substract(this.StartPoint); if (pos.substract(this.StartPoint).getLength() > movementVector.getLength()) { // end point reached, switch direction and restart var tmp = this.StartPoint; this.StartPoint = this.EndPoint; this.EndPoint = tmp; movementVector = this.EndPoint.substract(this.StartPoint); } // move movementVector.normalize(); pos.x += movementVector.x * delta * this.Speed; pos.y += movementVector.y * delta * this.Speed; pos.z += movementVector.z * delta * this.Speed; // set new position ccbSetSceneNodeProperty(node, 'Position', pos); return true; } |
||||
|
I have been trying to do something similar to this also. @cerrone: Wow, that is one heck of a script you got there. I am somewhat of a newbie when it comes to scripts, so I am wondering if I can ask you a favor: Is there a possibility you can make a very simple scene of a working example of this script in action? Nothing too fancy, just the camera and a moving platform, that's all. And once you have it done, I will really appreciate a lot if you were to post a download link to the actual CopperCube file(.ccb). By looking at the CopperCube file and studying carefully, I can get a better grasp on how everything works and comes together. |
||||
|
Help him! |
||||
|
I don't remember where but there was some guy who posted a ccb of a working elevator... do a Google on this site with elevator and see if you find it! good luck! |
||||
|
It was me who posted the demo of the working elevator... I posted it in 2016 for john maksym aka @54newstar... The mechanism is very simple and doesn't require any sort of programming... As i remember it was the very first demo posted by me on the forums... .. It was a comple demo with a simple story of space walkways... Wait lemme post the link to the thread here... https://www.ambiera.com/forum.ph... It contains cutscenes which can be skipped and a mission to kill a minoteur... Really makes me feel good remembering my early days with coppercube |
||||
|
Video: https://www.youtube.com/watch?v=... |
||||
|
this is my method) |
|