1

I,m using min3d framework on my device to make some car game, so i created some simple car model and simple and its moving, but i want to create ''physics'' and i need the collision detection which isn't provided in min3d (i won't change framework because i have android 2.1 without possibility to upgrade) i want to create it by my self but the problem is that i don,t know how to check if the plane collides with anything what i want to do is: -create simple flat rectangle (not cube) and i want to place it in front of ''car'' and check if something gets inside of this rectangle and something does i want the car to bounce of it in reversed direction (the problem isn't to bounce but: how to check if something gets through my rectangle)

I have some other problem too:/

When i enclose my ''game''(haha) with a LinearLayout in xml everythong is going fine till i use the command to set the text with the value of rotation of a car for example -then is force close:/ I'm doing it form my class from which i load my objects (i'm providing my classes too)

I was searching for tutorials on the web but none of them was tlaking about 3d collision and even if it was about 3d there was too much code that wasnt need and i was loast in it so i dont get anything

I ask you royal users from stackoverflow to provide me example for creating the rectangle(if needed, because i can laod model from .3ds and .obj)and check if something gets through it(intersects?) not for entire code but just for the method how to do that, and how to refrsh the value of a car, in layout without a crash

By the way: my ''game'' is using qwerty keyboard as input (i,o,p,l keys)

Wanted to post my class here but its to much of lines and was getting erros so grab it on free hosting site, its scanned by avast already on my pc, it contains my entire project with min3d too.

My sources ready to compile and run are(with min3d -which isn't mine): http://odsiebie.pl/ax1v1p5tam8i/KRL044.7z.html

thanks in advice:)

4

1 回答 1

0

一种方法是将其分解为两个维度(xy)。想象你的汽车是二维矩形。在您想检查碰撞的那一刻,只需检查“汽车”的四个角中的任何一个是否在另一辆车的矩形内。可能不是最佳实践,但对我有用。

而不是这个,你可以使用 r-tree sqlite 来检查碰撞。

于 2012-10-05T12:05:25.387 回答