Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Transform a Vector3

A topic by sheep_knight created May 05, 2016 Views: 300 Replies: 1
Viewing posts 1 to 2


So, in my game i would like the player to move considering his orientation, for exemple if the player's character looks on the right, pressing forward will transform the vector 1, 0, 0 to 0, 0, 1. I'm just looking for a transform function, but didn't found something corresponding to what I need. already use this line of code for the movement: CANNON.Vec3(Sup.Input.getGamepadAxisValue(0,0) * this.speed - v.x, velocity.y - v.y, Sup.Input.getGamepadAxisValue(0,1) * this.speed - v.z), pos);

thanks :)

Nevermind, I've corrected it :

let pos = new CANNON.Vec3(,,;

let vec = new Sup.Math.Vector3(Sup.Input.getGamepadAxisValue(0,0) * this.speed, velocity.y, Sup.Input.getGamepadAxisValue(0,1) * this.speed).rotate( CANNON.Vec3(vec.x - v.x, vec.y - v.y, vec.z - v.z), pos);