lewisje / renderengine

Automatically exported from code.google.com/p/renderengine
MIT License
0 stars 0 forks source link

SetRotation() for Physicsactor #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Calling setRotation(90); for an physicsactor, when he's not being simulated 
doesn't work.

Example code from the physics demo (game.js):
createToy: function(toyObject) {
var p = Point2D.create(700, 100);
toyObject.setPosition(p);
toyObject.setRotation(90);
toyObject.setSimulation(this.simulation);
this.getRenderContext().add(toyObject);
toyObject.simulate();
}

This doesn't work.
Neither does the following code:

createToy: function(toyObject) {
var p = Point2D.create(700, 100);
toyObject.setPosition(p);
toyObject.setRotation(90);
toyObject.setSimulation(this.simulation);
this.getRenderContext().add(toyObject);
toyObject.simulate();
toyObject.stopsim();
toyObject.setRotation(90);
toyObject.startsim();
}

where startsim() and stopsim() are defined as following Toy.js Methods:

    stopsim: function() {
       this.getComponent("physics").stopSimulation();
    },    
    startsim: function() {
       this.getComponent("physics").startSimulation();
    },

All the above code works with setPostion(); but not setRotation();
Maybe this is because setRotation(); isn't implemented in 
object.physicsactor.js ?

What is the expected output? What do you see instead?
The expected output should be that the Toyobject is rotated by 90°. But it's 
not rotated at all.

What version of the product are you using? On what operating system?
RE 1.5.3. on Windows 7 64bit. Browser Chrome 8

Maybe the 

Original issue reported on code.google.com by webidor...@gmail.com on 13 Dec 2010 at 8:15

GoogleCodeExporter commented 8 years ago
Note from mwebi on discussion groups:

Yeah, I managed to set the rotation of a physics object yesterday. 
I had to hack a bit into the engine though. I added a setRotation() in 
component.basebody.js 
What i added: 
    //rotation hack 
    setRotation: function(angle) { 
        this.getBodyDef().rotation=angle; 
    }, 
    //rotation hack2 
    getRotationRAD: function() { 
                return this.getBodyDef().rotation; 
        }, 

Original comment by bfatt...@gmail.com on 4 Jan 2011 at 2:31

GoogleCodeExporter commented 8 years ago

Original comment by bfatt...@gmail.com on 4 Jan 2011 at 2:32

GoogleCodeExporter commented 8 years ago
This issue has been resolved in v2.0 thru the usage of Box2dWeb library.

Original comment by bfatt...@gmail.com on 10 Feb 2011 at 8:12