mirror of
https://github.com/bloeys/nmage.git
synced 2025-12-29 05:18:21 +00:00
TODO
This commit is contained in:
19
main.go
19
main.go
@ -195,19 +195,20 @@ func (g *OurGame) Init() {
|
||||
|
||||
}
|
||||
|
||||
func vecRotByQuat(v *gglm.Vec3, q *gglm.Quat) *gglm.Vec3 {
|
||||
// @TODO: Add this to gglm
|
||||
// func vecRotByQuat(v *gglm.Vec3, q *gglm.Quat) *gglm.Vec3 {
|
||||
|
||||
// Reference: https://gamedev.stackexchange.com/questions/28395/rotating-vector3-by-a-quaternion
|
||||
qVec := gglm.NewVec3(q.X(), q.Y(), q.Z())
|
||||
// // Reference: https://gamedev.stackexchange.com/questions/28395/rotating-vector3-by-a-quaternion
|
||||
// qVec := gglm.NewVec3(q.X(), q.Y(), q.Z())
|
||||
|
||||
rotatedVec := qVec.Clone().Scale(2 * gglm.DotVec3(v, qVec))
|
||||
// rotatedVec := qVec.Clone().Scale(2 * gglm.DotVec3(v, qVec))
|
||||
|
||||
t1 := q.W()*q.W() - gglm.DotVec3(qVec, qVec)
|
||||
rotatedVec.Add(v.Clone().Scale(t1))
|
||||
// t1 := q.W()*q.W() - gglm.DotVec3(qVec, qVec)
|
||||
// rotatedVec.Add(v.Clone().Scale(t1))
|
||||
|
||||
rotatedVec.Add(gglm.Cross(qVec, v).Scale(2 * q.W()))
|
||||
return rotatedVec
|
||||
}
|
||||
// rotatedVec.Add(gglm.Cross(qVec, v).Scale(2 * q.W()))
|
||||
// return rotatedVec
|
||||
// }
|
||||
|
||||
func (g *OurGame) Update() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user