Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
would do i make my own first person camera controler? i know that theres already a premade one in the engine but i wanted to program my own bcs there some especifect movement mecanics i want to add, so i was wondering if i could somehow make a first person camera with movement in js |
||||
|
and also how do i add a colider to that, like not with the premade one inside the engine but add one with js |
||||
|
Both really complicated ideas. Collision means getting the distance between two objects and if they overlap, prevent the player from moving past it. The way I do it is just set the position to the position just before the overlap when it happens. If you try to manually do x,y,z you'll find out quick that the reposition doesn't do what it's supposed to. A player controller is a lot more complicated. Here's a little mind map; Get the player position and rotation [V] radius = rot.y * Math.PI / 180 |V| add-assign values for sine/cosine for rotation |V| Get sine and cosine to determine current player rotation |V| Determine yaw, pitch and roll for camera |V| Position target always forward of current camera rotation |V| Get mouse position x and y. If changes + or - to X and Y change camera yaw, pitch and roll |V| Lock cursor to screen center with some offset |V| Center target = mouse pos offset - offset |
||||
|
|