Jump to content

  • Log In with Google      Sign In   
  • Create Account


Collision Detection Physics Help


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 MrLolEthan   Members   -  Reputation: 106

Like
0Likes
Like

Posted 23 December 2012 - 10:22 AM

Ok so I have the detection done but does anyone have or know of an algorithm or help on doing the physics like not walking through the cube? 

 

 

        Thanks,

         Ethan



Sponsor:

#2 NoAdmiral   Members   -  Reputation: 503

Like
0Likes
Like

Posted 23 December 2012 - 12:16 PM

Well a lot of this depends on what you're wanting to do with your physics and what kind of game you're making. Is it tile-based or otherwise? What have you tried that you weren't satisfied with? Are you sure that your detection works?

Inspiration from my tea:

"Never wish life were easier. Wish that you were better" -Jim Rohn

 

herwrathmustbedragons.tumblr.com


#3 minibutmany   Members   -  Reputation: 1485

Like
0Likes
Like

Posted 23 December 2012 - 12:43 PM

If you have a block of code that handles gravity, just use an If statement and a boolean.

 

If(platformbelow == false)

{

gravity();

}

 

The gravity can be as simple as changing the character's Y position, or very complex if you so choose.


Edited by minibutmany, 23 December 2012 - 12:43 PM.

Stay gold, Pony Boy.

#4 MrLolEthan   Members   -  Reputation: 106

Like
0Likes
Like

Posted 23 December 2012 - 01:26 PM

Well a lot of this depends on what you're wanting to do with your physics and what kind of game you're making. Is it tile-based or otherwise? What have you tried that you weren't satisfied with? Are you sure that your detection works?

It's 3D and i'm using lwjgl (OpenGL) and I only want to do really basic stuff. I had an algorithm that worked but I couldn't detect where I walked into the cube. The algorithm was like on collision x -= x - sizeX (same with z), but since I cant detect what axis i'm hitting then cube on then it brings me to the same spot.



#5 m41q   Members   -  Reputation: 151

Like
0Likes
Like

Posted 25 December 2012 - 10:55 AM

It's 3D and i'm using lwjgl (OpenGL)

 

nice, me too ^^

To do the physics stuff, I use the JBullet engine, a java port of Bullet: http://jbullet.advel.cz/

Problem is, it´s a little bit outdatet and it has got an issue with direct and indirect buffers.

To get it to work with my own project, I fixed this issue (can send it to you, if you want), but you will still have to take some time to break into working with this engine.

 

But once you got it to work properly, it does ANYTHING for you ^^

This thing uses bullet, too:

 

It may take some time to get it to work, but for me, it totally was worth it



#6 Aardvajk   Crossbones+   -  Reputation: 5269

Like
0Likes
Like

Posted 25 December 2012 - 07:06 PM

It's 3D and i'm using lwjgl (OpenGL) and I only want to do really basic stuff. I had an algorithm that worked but I couldn't detect where I walked into the cube. The algorithm was like on collision x -= x - sizeX (same with z), but since I cant detect what axis i'm hitting then cube on then it brings me to the same spot.

You have two choices - you either find the minimum axis to move out along (i.e. the axis along which the intersection is smallest) or you take advantage of the fact that you know the direction the objects were moving to decide which way to move out.

If you are not using the direction the objects are moving or the previous positions of the objects, there is no "correct" direction to separate them by - imagine the objects come into existence intersecting, there is no correct way to separate them except along the minimum distance, which is commonly used in physics simulations.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS