Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Moving platforms (which you can stand on)?

j9907
Registered User
Quote
2018-11-15 03:25:25

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...


tim12345
Guest
Quote
2018-11-15 04:07:15

currently that is not supported right out of the box. gotta program it, unfortunately!


j9907
Registered User
Quote
2018-11-15 04:08:38

Ah, darn it. Hmm.... What a shame! I'll have to modify the level a bit to get around this (sad) limitation I suppose...


cerrone
Registered User
Quote
2018-12-08 23:27:22

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;
}


santito
Registered User
Quote
2018-12-11 00:22:07

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.


helperMC
Guest
Quote
2020-04-21 15:38:41

Help him!


aloan
Registered User
Quote
2020-05-09 02:56:56

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!


just_in_case
Moderator
Quote
2020-05-09 16:33:55

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


ngame
Registered User
Quote
2020-05-18 15:30:28

Video:
https://www.youtube.com/watch?v=...



/<o>\
Guest
Quote
2020-05-18 16:50:19


this is my method)


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact