Hi!
I am about to do some physics in my game and I’m using a tutorial BUT when i use this code in cocos2d-x 3.7 it says that there’s no member named “Step” and/or “ClearForces” Please take a look: [code] static double UPDATE_INTERVAL = 1.0f/60.0f;
static double MAX_CYCLES_PER_FRAME = 5;
static double timeAccumulator = 0;
timeAccumulator += dt;
if (timeAccumulator > (MAX_CYCLES_PER_FRAME * UPDATE_INTERVAL)) {
timeAccumulator = UPDATE_INTERVAL;
}
int velocityIterations = 3;
int positionIterations = 2;
while (timeAccumulator >= UPDATE_INTERVAL) {
timeAccumulator -= UPDATE_INTERVAL;
sceneWorld->Step(UPDATE_INTERVAL,
velocityIterations, positionIterations);
sceneWorld->ClearForces();
//The sceneWorld initializing:
cocos2d::PhysicsWorld* sceneWorld;
}[/code]
What can i use instead of these functions?
Thanks! i appreciate ur time!
Update: @slackmoehrle, do u have suggestions? I mean, I know u are in with this so…Or anybody_
Why is Step() with a capital s? There is a step() api call.
1 Like
No, it does;t exist neither and btw, i don’t think it’s box2d because objects like bodies are initialized using “PhysicsBody” and not like how you usually do it when using box2d? So, how can i receive the same function? :*(
Thanks, i’d appreciate just a reply, thanks again!
Ok wait, let me try once again…
Thanks!
Oh yea @slackmoehrle, i got, it can now find the function but i try to use it, it says that it can’t have 3 arguments but i can’t get what i want without them?
Ok thanks, igot that…But i can’t receive the same output when i can only use 1 argument and not three as the old code?
Please help, i appreciate your time!
Sorry, can you clarify a bit, you need the 3 arguments you were passing to Step()? And step() you can’t accomplish this.
The built in physics in Cocos2D-x is not Box2D. However box2D does come provided in the Cocos2D-x library. You can access it by including the header files for it with this line.
#include "Box2D/Box2D.h"
If you’re following a Box2D tutorial then you should be using Box2D physics.