Obstacle

Can I detect the obstacle with this sdk for example I want to move a wheelechair in a house and ithere is a wall ,the wheelchair should stop

thinks for your answer

It s not the goal of the sdk but you can calculate the bouding box collision detection of the meshes and apply a simple translation in the oposite direction :slight_smile:

the beauty of this sdk is the ease of manipulation of meshes and shaders…

for instance :

PVRTVec3 vBoundingBoxMin, vBoundingBoxMax;<br />
<br />
// calculate bounding box for mesh 0<br />
float* pfData = (float*)Mesh.pInterleaved;<br />
vBoundingBoxMin.x = vBoundingBoxMax.x = pfData[0];<br />
vBoundingBoxMin.y = vBoundingBoxMax.y = pfData[1];<br />
vBoundingBoxMin.z = vBoundingBoxMax.z = pfData[2];<br />
<br />
for(unsigned int i = 1; i < Mesh.nNumVertex; ++i)<br />
{<br />
pfData = (float*)(((char*)pfData) + Mesh.sVertex.nStride);<br />
<br />
vBoundingBoxMin.x = PVRT_MIN(vBoundingBoxMin.x, pfData[0]);<br />
vBoundingBoxMin.y = PVRT_MIN(vBoundingBoxMin.y, pfData[1]);<br />
vBoundingBoxMin.z = PVRT_MIN(vBoundingBoxMin.z, pfData[2]);<br />
vBoundingBoxMax.x = PVRT_MAX(vBoundingBoxMax.x, pfData[0]);<br />
vBoundingBoxMax.y = PVRT_MAX(vBoundingBoxMax.y, pfData[1]);<br />
vBoundingBoxMax.z = PVRT_MAX(vBoundingBoxMax.z, pfData[2]);<br />
}<br />
<br />
for (int i = 0; i < 8; ++i)<br />
{<br />
m_avBoundingBox<i>.x = (i & 1) ? vBoundingBoxMin.x : vBoundingBoxMax.x;<br />
m_avBoundingBox<i>.y = (i & 2) ? vBoundingBoxMin.y : vBoundingBoxMax.y;<br />
m_avBoundingBox<i>.z = (i & 4) ? vBoundingBoxMin.z : vBoundingBoxMax.z;<br />
m_avBoundingBox<i>.w = 1.0f;<br />
} 
```<br />
<br />
or use a real collision detection engine , there is plenty on the net.<br />
<br />
Kind regards<br />
david</i></i></i></i>

I don’t understand

for (int i = 0; i < 8; ++i)

{

m_avBoundingBox.x = (i & 1) ? vBoundingBoxMin.x : vBoundingBoxMax.x;

m_avBoundingBox.y = (i & 2) ? vBoundingBoxMin.y : vBoundingBoxMax.y;

m_avBoundingBox.z = (i & 4) ? vBoundingBoxMin.z : vBoundingBoxMax.z;

m_avBoundingBox.w = 1.0f;



m_avBoundingBox refer to what?

Hi,



As David has mentioned, the aim of the SDK is to provide optimized graphics rendering examples along with the basic building blocks for writing a graphics application (PVRShell & PVRTools). To ensure it’s streamlined for its primary purpose, the SDK does not include collision detection, physics, networking and a variety of other technologies you will most likely need for a production ready application.

David’s example is a simple mechanism for generating bounding boxes so his application can efficiently test for collisions.



I’ve used Bullet physics with the SDK before for collision detection & response. Depending on your use case, a simpler framework like Box2D may be more suitable though.



Regards,

Joe