About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Camera Collision with terrain object
Author Message
Lancer Offline
Bronze Supporter

Post: #1
Camera Collision with terrain object
Hi,

I've put several buildings into the world.
Now I tried the camera colission tutorial from game basics.

My issue:
Collision with ground works fine, but does not work on buildings.
Path Mesh on objects has been set to "Fully Block".

Code (copied from tutorial)
Code:
desired_camera.yaw  -=Ms.d().x;
desired_camera.pitch+=Ms.d().y;
Clamp(desired_camera.pitch, -PI_2, PI_4);
desired_camera.dist=Max(1.0, desired_camera.dist*ScaleFactor(Ms.wheel()*-0.2));
desired_camera.at  =Players[0].ctrl.center();
desired_camera.setSpherical();

Ball ball(0.1, desired_camera.at);

Physics.move(ball, desired_camera.matrix.pos-ball.pos, ~IndexToFlag(AG_CONTROLLER));

Cam.setPosDir(ball.pos, desired_camera.matrix.z, desired_camera.matrix.y);

Cam.updateVelocities().set();

I have no idea what else I could try.
07-23-2019 08:01 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Bronze Supporter

Post: #2
RE: Camera Collision with terrain object
hi,

// use physics movement to move the ball as far as it can go without any collisions (ignore collisions with controllers)

Make sure your building have a physic to trigger the collision from the ball ( camera ball )

that should do the trick. ( it does not use the path mesh to stop collision, but physics)
07-23-2019 08:45 PM
Find all posts by this user Quote this message in a reply
Lancer Offline
Bronze Supporter

Post: #3
RE: Camera Collision with terrain object
Hi,

thanks.
I just did the physics and it works fine.
07-23-2019 08:51 PM
Find all posts by this user Quote this message in a reply
Post Reply