Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
Footsteps

Wire
Guest
Quote
2024-05-06 20:49:36

How can I put footsteps sounds in first person?


vp
Guest
Quote
2024-05-09 12:50:44

https://www.ambiera.com/coppercu...


Wire
Guest
Quote
2024-05-09 21:34:23

It doesn't work properly!


okeoke
Registered User
Quote
2024-05-19 09:34:42

https://drive.google.com/file/d/...

// The following embedded xml is for the editor and describes how the behavior can be edited:
// Supported types are: int, float, string, bool, color, vect3d, scenenode, texture, action
/*
<behavior jsname="behavior_FootSteps" description="Footsteps">
<property name="stepLength" type="float" default="40.0" />
<property name="actionOnStep" type="action" default="" />
<property name="groundCheckVectorDist" type="float" default="16.0" />
</behavior>
*/

var behavior_FootSteps = function () {
this.traveledDistance = 0;
this.lastPos = null;
};

behavior_FootSteps.prototype.onAnimate = function (node, timeMs) {
if (!this.lastPos) {
this.lastPos = ccbGetSceneNodeProperty(node, 'Position');
this.lastPos.y = 0;
return false;
}

var pos = ccbGetSceneNodeProperty(node, 'Position');

// check if player is grounded
var isGrounded = !!ccbGetCollisionPointOfWorldWithLine(
pos.x, pos.y, pos.z,
pos.x, pos.y - this.groundCheckVectorDist, pos.z
);

// ignore vertical movement
pos.y = 0;

this.traveledDistance += pos.substract(this.lastPos).getLength();

// reset traveled distance if stops
if (pos.x === this.lastPos.x && pos.z === this.lastPos.z) {
this.traveledDistance = 0;
}

// reset traveled distance if not grounded
if (!isGrounded) {
this.traveledDistance = 0;
}

if (this.traveledDistance > this.stepLength) {
this.traveledDistance = - this.stepLength / 2;
ccbInvokeAction(this.actionOnStep, node);
}

this.lastPos = pos;

return true;
}



Wire
Guest
Quote
2024-05-19 12:27:36

Thanks for replying!I think I've figured it out.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (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