Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

body.setRotation(mtx) don't work #10

Closed
dekwilde opened this issue Mar 19, 2014 · 4 comments
Closed

body.setRotation(mtx) don't work #10

dekwilde opened this issue Mar 19, 2014 · 4 comments

Comments

@dekwilde
Copy link

setRotation:function(x,y,z){
var r = OIMO.EulerToAxis(x* OIMO.TO_RAD, y* OIMO.TO_RAD, z* OIMO.TO_RAD);
var rad = r[0];
var len = r[1]r[1]+r[2]r[2]+r[3]r[3];
if(len>0){
len=1/Math.sqrt(len);
r[1]
=len;
r[2]
=len;
r[3]
=len;
}
var sin=Math.sin(rad_0.5);
var cos=Math.cos(rad_0.5);

    //this.body.rotation = new OIMO.Quat(cos,sin*r[1],sin*r[2],sin*r[3]);
    this.orientation = new OIMO.Quat(cos,sin*r[1],sin*r[2],sin*r[3]);
    //this.orientation = new OIMO.Quat(r[0], r[1], r[2], r[3]);     
}
@lo-th
Copy link
Owner

lo-th commented Sep 3, 2014

i'm on new update
some new function
body.getPosition() return Vect3 of position in simulation scale;
body.setPosition(Vect3) -> move dynamique object anywhere
body.resetPosition(x,y,z) -> move object to this position and reset velocity

i do the same for rotation
body.getRotation() return Euler of rotation (x,y,z,order) order is alway default 'XYZ'
body.setRotation(Euler) -> rotate dynamique object (x,y,z)
body.resetRotation() rotate object to this rotation and reset velocity

rotation is not full complete but i'm near

@dreadCapnFowl
Copy link

What the fuck does resetRotation is supposed to be?

setRotation, as in like

why does it bounce my player into oblivions. Hold up....

@dreadCapnFowl
Copy link

wait... i think i got it

youre engine is SO counterintuitive mgl;

Let me tell you what, look up THREE.js and basically make it work with it nobrainerly, I will pay you when I get profit

@dreadCapnFowl
Copy link

getRotation() isn't even a function

If I do
obody.setRotation(0, angle, 0); obody.resetRotation()
It dies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants