Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Not Move To x ;)

3dnoob
Registered User
Quote
2018-08-14 12:41:14

I need some good tips to determine if a fixed distance is a collision.

Example:
My player moves by keyboard through the game world.
If a distance is smaller (x) to the left or to the right or up or down, it should be used as a trigger.
(the player must not move in this direction.)
So if you are in a hallway and there is a wall to the left and right, it is pointless to move in that direction.

.....
How can I query the scene object at a determined position in the 3d scene?

How do I get the ID of the objects around a specified position from the player?
......

Does anyone have any programming tips?


3dnoob
Registered User
Quote
2018-08-14 15:14:03

How can you achieve a good movement around corners?

My ugly Example:( Update !)

https://workupload.com/file/6GCC...

I need help with the corner movement.


3dnoob
Registered User
Quote
2018-08-14 18:18:48

Can someone once a good example with:
CcbDoesLineCollideWithBoundingBoxOfSceneNode (...)
Show?

( I think I make logical and mathematical mistakes. )

Thanks in advance.


3dnoob
Registered User
Quote
2018-08-14 19:00:10


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

//var colTest = ccbGetCollisionPointOfWorldWithLine(pos3d.x, pos3d.y, pos3d.z, (pos3d.x-5), pos3d.y, pos3d.z);
var colTest = ccbDoesLineCollideWithBoundingBoxOfSceneNode(cube, pos3d.x, pos3d.y, pos3d.z, 0, 0, 0); //return always true ???

print("x: "+pos3d.x +" y: " + pos3d.y + " z: " + pos3d.z);

print("Move_Down: "+Move_Down);
print("Collision: "+colTest);
if (colTest && Move_Down == 1)
{
print("Not Move!!!");
}
else
{
print("Here!!!");
Move_Up = 0;
Move_Down = 1;
Move_Left = 0;
Move_Right = 0;
}


I'm too stupid for this feature:

"CcbDoesLineCollideWithBoundingBoxOfSceneNode (...) "

How can I query the environment?



var colTest = ccbDoesLineCollideWithBoundingBoxOfSceneNode(cube, pos3d.x, pos3d.y, pos3d.z, (pos3d.x+5), pos3d.y, pos3d.z); //return true ??? (In this position is actually nothing.)

I'm trying to debug it, but the function always returns TRUE.

I think I'm doing something fundamental wrong here.

It should actually behave as in this example:
(But it doesn't!)


  var mouseX = ccbGetMousePosX();
var mouseY = ccbGetMousePosY();

// test collision

var cube = ccbGetSceneNodeFromName("cubeMesh");
var endPoint3d = ccbGet3DPosFrom2DPos(mouseX, mouseY);
var startPos3D = ccbGetSceneNodeProperty(ccbGetActiveCamera(), "Position");

if (ccbDoesLineCollideWithBoundingBoxOfSceneNode(cube, startPos3D.x, startPos3D.y,
startPos3D.z, endPoint3d.x, endPoint3d.y, endPoint3d.z))
{
ccbDrawColoredRectangle(0x77ff0000, mouseX-10, mouseY-10, mouseX+10, mouseY+10);
}
else
ccbDrawColoredRectangle(0x770000ff, mouseX-10, mouseY-10, mouseX+10, mouseY+10);
}


???


just_in_case
Moderator
Quote
2018-08-15 06:21:27

I can understand that you are trying to implement a path finding system.... But it is currently not possible with the available javascript api..... It can be possible if we have more collision detetction api....for the use of ccbdoeslinecollidewithboundingbox .... You can use it... But the collision detected by this is not accurate... If you try to use this with a scene node which has already a collide when moved behaviour attached...there maybe chances that this method will not detect any collision..and if your object doesn't have any collide when moved behaviour then it will detect the collision but that may not be that accurate..... So in short you should wait... A little untill a better collision detection api is released by niko...

But if you want you can try experimenting... Because sometimes there are other methods which i can't see but can work for others...
Hope my feedback helped 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© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact