Integrated Physics Simple Question? HELP

I am trying integrated physics cocos2d-x v3.2
I read that it uses chipmunk internally…

I put 4 things in my scene

  1. A ball controlled by accelerometer as told in cpp tests. This ball size is very small~ height of the thin bar below.
  2. A thin static bar/platform- size around 1/4 the screen width and 1/8 the screen height
  3. A thick static bar/platform- size around 1/4 the screen width and 1/8 the screen height
  4. And the physics boundary of the screen…

None of the above is hollow body… (except the edge boundary of screen which is created using edgeBox)

I’ve used bit masks to ensure collision between ball and the bars/platform and walls.

Now, this ball should collide and should not enter those bodies…
But it is entering those bodies when I am turning the ball using accelerometer and pushing it against the platform or exiting the screen boundary, I mean out of the screen…

I think I realized that it is happening due to that fact that ball speed is a little more then what physics could handle.
So it enter the platforms in jerky motion. Where jerky motion comes because it tried to stop the ball to enter the bars/platform.
But if I decrease the speed of the ball then it would appear to move very very slow…

I saw a test case in cpptests for one-way platform…
Second thing, I realized that my ball size is small… So this is also a problem…

But I want to keep the size and speed everything as i wanted… and still don’t want it to collide and not enter into each other…

What is the work around?

Please help/!!!

Explain these 3 things to me first.
or else give a screenshot so i could get an idea what you are planning to achieve.
what i could understand from you is that, you are trying to create a brick breaker game
with the ball controlled by the accelerometer.

But that’s a different case.

That’s a funny one.
common it’s not an alien ship.
this may be due to the reason that the densities of the ball is highier than that of your other physics bodies.

consider like this, a paper is also a physics body and an ironball is also a physics body
when you drop the iron ball on the paper, it tears it up and go through it ( unless the paper is on the ground)

you need to set the densities of different materials as different.
for the ball set density less than the screen boundary and the paddle
for paddle set the density less than the screen boundary so it will not pass through it.

That would solve the problem… if i got you right… :wink:

Happy Coding

Have you seen accelerometer test of cpptests ?
It is EXACTLY what I am doing…

No nothing like that… I am just trying the integrated physics :smiley:

My ball speed is not too much that it can be handled by physics… But it is too much that if I force the change of ball’s position using accelerometer then it can pass through other bodies for which I want work around

Do you know what bullet in Box2d is?

I was relating it to that concept…
It is when a body is moving very fast in physics world… and we’re explicitly telling the box2d framework that this body is kind of bullet(not actually real bullet but a body moving very fast) so take care for it in terms of calculation so that it doesnot enter other physics body…

So, I was thinking that if there is something which I can do in integrated physics which has based on chipmunk…
I think we cannot do this in chipmunk and so in integrated physics engine…
So , I was asking for the work around…

You talked about densities… Fine I will tweak the densities of both bars and see what changes…
Though I am quite sceptical whether it will be work…

But still do you’ve any explanation for ball exiting screen edge box…

To still get idea of what I am doing…

I did following steps:

  1. New project… And I am working just in HelloWorld.cpp file
  2. Create physics scene, gravity set to 0.
  3. Add edge box to the screen boundary.
  4. Add a small circular sprite and adding circle physics body to it
    I made it dynamic.
  5. Adding 2 sprites called bars (box-rectangled shaped) of widths and heights as mentioned in first post…
    I made them both static
  6. Then adding a listener so that ball could change its position according to accelerometer…

Now, normally if I would have simply dropped the ball under gravity, then ball wouldn’t have exited the edge boundary of the screen because of physics body obviously… and neither it would have tried to enter *** THROUGH *** ** both the bars. **

** But the problem is I am changing the ball’s position using accelerometer which is forcing the ball to move THROUGH bars or the screen edge box
The condition become worse because ball size is small and when I try to increase the value of speed variable of the ball on accelerometer…

Are you getting the picture… see the lines in bold again.. This is my problem!! Accelerometer is forcing the ball to move through the other physics body…

do you have an apk which i can test… ??

So you are saying that you are intentionally doing the bullet concept on the integrated physics engine.
and you want the physics engine to stop the incredibly fast moving thing with it’s boundaries.

hmm…
can you please send me your apk… i want to know… what exactly you are referring to.
my mail id is

pabitrapadhycse@gmail.com

No I am not doing bullet concept… bullet concept is for high speed…
But I am not having any high speed body…
It was just to make my point clear that a body can pass through other body in 2 ways(as I am aware of)
One, when I force it to do so… like I am doing it…
Second, when the speed is too high, which is handled by bullet concept in box2d and I don’t know about chipmunk.

So, since my body is not fast enough but exactly the same speed as of cpptests (Have u tried accelerometer test in cpptests… u can get the idea of the speed…) Its not fast… and hence not even incredibly fast…

which one… ??

can you specify the exact one…??
the chipmunk one
or the node physics last one… ??

I didn’t get that… I saying accelerometer test which is under events… I told clearly ‘accelerometer test in cpp tests’
and accelerometer is an event :smiley:
So it is not under physics… For accelerometer test I want to just show the you the speed of the ball’s motion…

So, I tried changing the densities and it didn’t work :frowning: