Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Position Problem

3dnoob
Registered User
Quote
2018-08-15 14:02:16

I try something with grid movement (this is easier than right movements around a corner without fixed speed)

I need help setting the right positioning.

Somehow my player always jumps to the next wall and not to the other side of the level.


Attempt:

https://workupload.com/file/YwTS...




var cube = ccbGetSceneNodeFromName("Paci");
var pos3d = ccbGetSceneNodeProperty(cube, "Position");

var tx = Math.abs(pos3d.z) / 10;
var ty = Math.abs(pos3d.x) / 10;
tx = parseInt(tx.toFixed(0));
ty = parseInt(ty.toFixed(0));

if ( tx >= 0 && tx < 20 )
{
if (Level[tx+1][ty] == 1)
{
print("Not Move!!!");
}
else
{
print("Move!!!");
pos3d.z -= 10.0;
ccbSetSceneNodeProperty(cube, "Position", pos3d);
Move_Up = 0;
Move_Down = 0;
Move_Left = 0;
Move_Right = 1;
}
}
else
{
pos3d.z = 0.0; //??? What do I have to put here?
ccbSetSceneNodeProperty(cube, "Position", pos3d);
}



Can I simply turn the collision detection of the walls on and off by JavaScript?
That would be very nice.

……..
You can do this here:


for ( i = 0; i <= 441; i++)
{
ccbSetSceneNodeProperty(LevelWall[i], "Visible", false);
}

pos3d.z = 0.0; //???
ccbSetSceneNodeProperty(cube, "Position", pos3d);


But it would be incredibly important if you could do something like this:


for ( i = 0; i <= 441; i++)
{
ccbSetSceneNodeProperty(LevelWall[i], "Collision", false);
}



3dnoob
Registered User
Quote
2018-08-15 15:02:32

Oh I have overlooked this function:

CcbSetSceneNodePositionWithoutCollision (SceneNode, x, y, z)


So the subject has settled.


Create reply:


Posted by: (you are not logged in)


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