Slow and fast motion in physic

Slow and fast motion in physic
0.0 0


how can I implement slow and fast motion in physics in cc 1.5?


Any Idea???


What do you mean?


I think the question is clear!!!
for example : I have an object that falling in a gravity field so I want to slow down falling object after some dt from starting .
I DON’T want to reduce gravity values to do this.


The physics in Creator uses Box2d.

I hope this link would help:


Thanks I read this before but did’t help!!
Also I test cc.director.getPhysicsManager()._world.Step(a,b,c) but did’t work.


There is something like world->setspeed(float)
And i dont know if u can, but maybe you could turn off the autostep and call the world step by yourself with any delta time u want


There is’t such thing in cc.


How about using the gravity scale property?


don’t worry
For controlling speed of Physics see:
under the tab Container Action — 5 section.
use that idea.


cc.speed is for controlling speed of an action it is not for physic speed!!!


yes but you can use it to slow down your falling object. if you don’t know how to do that. i will explain with example.


I don’t know how to use it, please explain .


ok i will explain but let me know that you want:
that the speed of the falling object (which have fast speed ) decrease speed gradually while coming to ground, e.g first it have speed of 2s and after some dt it change to 1.5s and 1s… ???
that the speed of the falling object remains constant from top to ground, e.g 1s ( slow speed).???
are you getting me?
i will answer according to your reply


@Salman Using box2d elements and manipulating their movement/ behavior using cocos animation module is pretty bad idea. It will cause problems with collision resolution and affect objects in unexpected way.

@hossainiir try cc.director.getPhysicsManager().gravity = cc.v2(x,y); by changing gavity scale at appropriate time you can achieve slow motion on falling elements.


@Lazy_Gamer, @hossainiir do not want to change gravity, using Action is his only option i know for him.


Thanks my friends ,but I think there should be a better way, for example a parameter that change dt in physics update!!!


In cocos creator v1.5.1:
write this code in
var action = cc.speed(
cc.moveBy(speed_of_object, x, y)
), 0.5);
1Step: now in place of speed_of_object you can write any value i-e 0.1, 0.2 or 1 or 2 etc
Note: 0.1 is fast and 1 is slow and 10 is slowest value and so on.
2Step: in place of x write value of x. i-e 0 or any value.
3Step: in place of y write value of y. i-e -500 or any value where at which height you want to spawn it.
and then add this code to one of the node and try it out.


I solved the problem by overriding default update of PhysicsManager ,this is the code :

physicsManager = cc.director.getPhysicsManager()
physicsManager.speed = 4
	world = physicsManager._world
	if (!world || !physicsManager.enabled) then return
	physicsManager._steping = true
	timeStep = physicsManager.speed/['frameRate']
	world.Step(timeStep, 10, 10);
	physicsManager._steping = false;
	events = physicsManager._delayEvents;
	for i in []
		event = events[i]
		if event[event.func].apply(, event.args);
	events.length = 0;

by changing the physicsManager.speed value you can have fast or slow motion


How do you let physicsManager.update() to run? I see it get called in in browser but not in simulator.