Thanks i (think i) understand how to detect objects now.
How about the second half of the question? Any ideas? Maybe if i try translating current position of the ball to the hit item's coordinate system and see if it does? Or is there a better way?
QGraphicsItem::collidingItems() returns a list of items colliding with a particular item.
Hmmm... what do you mean "how"? You mean physics?
BTW. Have you seen this?
http://doc.trolltech.com/qq/qq20-jambi.html
I have seen that example but except for some code for working with the scene there isnt really anything i need.
And to explain what i need... right now i have a ball object which has x and y velocity. So every time a time trigger triggers i move it by that values. But now i dont know whether the ball hit something by its x axis (where i have to invert the x velocity) or y axis (where i have to invert the y velocity).
One idea i had is to move the ball only by x or y every time i have a time trigger event and then check for collision but im not sure if its such a good idea.
So if you have a better idea it would really mean a lot
Thanks
edit: damn im dumb.. if i get a list of items colliding with the ball i can simply check which coordinates equals those of the ball.![]()
Last edited by Binji; 29th December 2007 at 12:10.
Binji (30th December 2007)
Bookmarks