Laurane Bernard
Laurane Bernard

Reputation: 219

three.js - principle of camera collision

As I understood the only method to compute collisions with three.js is intersectObjects with a ray ...

I created an object that includes the basic elements of the collision : ground, walls, objects, stairs. with the firstpersoncontrols. I went with the idea that I should calculate the steering vector based on the direction in which the camera is currently traveling but it does not really work and I do not see where the error is.

I expected that the camera can not pass through ground, walls and objects with which she finds herself in a collision.

You can see the code here

Upvotes: 0

Views: 1650

Answers (1)

WestLangley
WestLangley

Reputation: 104793

three.js has no automatic collision detection.

You implement ray-casting with Raycaster now, not Ray:

Raycaster.intersectObjects( objects, recursive );

You also have to control the elevation of the camera yourself.

three.js r.54

Upvotes: 2

Related Questions