Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name: Password:
Ambiera Forum > CopperCube > Help with CopperCube
third person And sm third person has this..
Author Text

edwin123
Registered User
Quote
2022-12-06 23:24:46

when i turn the cam the player done not turn i said to my self maybe be if i right cilck it will work and it didnt pls help any help i will take.



thank you.


VP
Guest
Quote
2022-12-08 09:23:30

Can you explain a little more please? The 3rd person cameras usually follow the player. You can make the player follow a 3rd person cam (if that's what you're trying to do?) - with or without coding.


edwin123
Registered User
Quote
2022-12-08 16:22:55

i need the player to follow the cam like wwz or something


edwin123
Registered User
Quote
2022-12-13 02:37:10

can you help with that?


edwin123
Registered User
Quote
2022-12-17 18:48:07

hello?


VP
Guest
Quote
2022-12-19 07:33:37

There are a few plugins that allow one node to follow another. Probably the easiest in this case is the "Move AI towards node" plugin. To do this, just add a game behaviour to the camera and the player nodes and set the "move AI towards node" on the player node to move towards the camera node every few milliseconds.....

/* <action jsname="action_MoveAIM" description="Move AI in direction of a Node">
<property name="TargetNode" type="scenenode" />
<property name="AOffset" type="float" default="5." />
</action>
*/

action_MoveAIM = function() {};

action_MoveAIM.prototype.execute = function(currentNode) {
var position = ccbGetSceneNodeProperty(currentNode, "Position");
var newpos = ccbGetSceneNodeProperty(this.TargetNode, "Position");

ccbAICommand(currentNode, "moveto", newpos);
var moveto = (newpos);
var mvec = moveto.substract(position);
mvec.normalize();
mvec.x=Math.round(mvec.x*this.AOffset);
mvec.y=Math.round(mvec.y*this.AOffset);
mvec.z=Math.round(mvec.z*this.AOffset);
ccbAICommand(currentNode, "moveto", moveto.add(mvec));
}

/*
Action created by:
Dude
*/


VP
Guest
Quote
2022-12-19 07:36:04

...another alternative would be the "follow" plugin combined with "rotate one object towards another object" from just_in_case's neophytes website.

Set the follow plugin on the player node to "follow the camera" edit the plugin to change the camera distance from the node it is following....


/*
<behavior jsname="behavior_follow" description="Follow">
<property name="NodeToFollow" type="scenenode" />

</behavior>
*/

behavior_follow = function(){
}
behavior_follow.prototype.onAnimate = function(currentNode){



var curPos=ccbGetSceneNodeProperty(this.NodeToFollow,"Position");
ccbSetSceneNodeProperty(currentNode,"Position",curPos.x+0,curPos.y+0,curPos.z+0);

}


veganpete
Registered User
Quote
2022-12-19 07:38:00

...and finally, you could use "follows me" plugin (I think you need to add "game character" behaviours on both nodes again, for the AI to work).....

/*
<behavior jsname="behavior_Follow_Me" description="Follows Me">
<property name="WhoFollows" type="scenenode" default="" />
<property name="Delay" type="int" default="50" />
</behavior>
*/

behavior_Follow_Me = function()
{
this.Occurring_Time = 1;
};

behavior_Follow_Me.prototype.onAnimate = function(currentNode)
{
// Interval Occurring:
if (this.Occurring_Time > this.Delay)
{
// Follows SceneNode:
this.Occurring_Time = 1;
ccbAICommand(currentNode, "moveto", new ccbGetSceneNodeProperty(this.WhoFollows, "Position"));
}
this.Occurring_Time += 1;
return true;
}


edwin123
Registered User
Quote
2022-12-19 17:52:29

Thank you so much for this, but how do i make it or get the plugin?


coa
Registered User
Quote
2022-12-20 07:15:21

to use the extensions VP posted

you need to save the script with the same name as jsname

for example for this script below you need to save it in documents/coppercube/extensions/

as behavior_follow.js

/*
<behavior jsname="behavior_follow" description="Follow">
<property name="NodeToFollow" type="scenenode" />

</behavior>
*/

behavior_follow = function(){
}
behavior_follow.prototype.onAnimate = function(currentNode){



var curPos=ccbGetSceneNodeProperty(this.NodeToFollow,"Position");
ccbSetSceneNodeProperty(currentNode,"Position",curPos.x+0,curPos.y+0,curPos.z+0);

}



just_in_case
Moderator
Quote
2022-12-20 07:51:08

@edwin123 There is an option in the SM thirdperson camera afaik that allows to turn on the rotation with mouse on and off or control the player rotation with the arrow keys. I think that's what you are facing that your player is not turning when you rotate the camera with the mouse. Your camera look direction changes but your player still looks in its original direction and doesn't turn towards the camera target.

Let me know if this is the case with you. As I personally didn't used the extension in any of my project, I don't remember the options that much, but I beleive there are options in the @Saman's TPP controller to do that.


edwin123
Registered User
Quote
2022-12-20 16:53:45

i got it to work Thank you!



Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internati?nal" (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© 2020 Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact