Finding 'Point of Collision'

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
nano
Posts: 25
Joined: Mon May 07, 2007 1:12 pm

Finding 'Point of Collision'

Post by nano »

We're trying to create our own physics for objects (and yes, we must do this, we cannot use third-party) but to do this we need to be able to calculate the point of collision between two objects.

We're using .irr files for the OCTTREE's (created with this code snippet: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=23707) which are used in the collision detection against the camera, but when we start adding other nodes (animated meshes and other small static meshes) we want to be able to find the point of collision when two objects collide. Is it possible to output and catch this value somehow?

Does irrNewt do this? We can use something like irrNewt, we only need the collision detection side of it though, the actual physics calculations we will be doing ourselves.

Thanks
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Re: Finding 'Point of Collision'

Post by sio2 »

nano wrote:Does irrNewt do this?
IrrNewt uses a third-party physics engine, which immediately disqualifies it based on your requirements.

Can you not use a physics engine for which the source code is available? I'm curious as to why you can't use third-party - writing a good physics library isn't a simple task (unless you've already written one before).
nano
Posts: 25
Joined: Mon May 07, 2007 1:12 pm

Post by nano »

Sorry if you misinterpreted what i said, we can use a third party tool such as irrNewt to find the point of collision (if it does this), we just can't/won't use any of its actual physical calculations.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Yes, irrNewt should do what you want. I'd also recommend having a look at OpCode, which is a pure collision library, and pretty easy to integrate.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

nano wrote:Sorry if you misinterpreted what i said, we can use a third party tool such as irrNewt to find the point of collision (if it does this), we just can't/won't use any of its actual physical calculations.
IrrNewt is just a wrapper. It does not do physics itself. Without Newton it will not work.
nano
Posts: 25
Joined: Mon May 07, 2007 1:12 pm

Post by nano »

Thanks rogerborg i'll check it out.

And sio2, i'm aware of what it is. My question was can it return a point of collision between nodes without us having to use it for anything else.

Edit: I've been trying to get the IrrNewt examples to compile and i'm running into some Unresolved External Symbol errors, wondering if you guys know what i'm doing wrong.

I'm using Irrlicht 1.3.1, IrrNewt 0.4 and Newton 1.53.

I'm trying to compile the 'Ragdoll' example (chosen at random).

I've set my VC++ (.net) directories as such:

INCLUDE:
C:\Program Files\NewtonSDK\sdk
C:\Irrlicht\IrrNewt\include
C:\Irrlicht\irrlicht-1.3.1\include

LIB:
C:\Program Files\NewtonSDK\sdk\lib_st
C:\Irrlicht\IrrNewt\lib\win32-vc++6
C:\Irrlicht\irrlicht-1.3.1\lib\Win32-visualstudio

EXECUTABLE:
C:\Program Files\NewtonSDK\sdk\dll
C:\Irrlicht\IrrNewt\bin\visual_studio
C:\Irrlicht\irrlicht-1.3.1\bin\Win32-VisualStudio

I wasn't sure about the Newton lib as i couldn't actually find any documentation on what lib_st, lib_mt, lib_st_double and lib_mt_double actually meant, i just assumed it meant something like single threaded, multiple threaded and just went with _st.

I'm not sure if these have anything to do with the errors i'm getting. I put the Newton.dll from the Newton dll directory into my windows>system32 directory too just incase but that made no difference either.

And i'm getting the following errors:

Code: Select all

project error LNK2001: unresolved external symbol "class irr::newton::IWorld * __cdecl irr::newton::createPhysicsWorld(class irr::IrrlichtDevice *)" (?createPhysicsWorld@newton@irr@@$$FYAPAVIWorld@12@PAVIrrlichtDevice@2@@Z)
project error LNK2001: unresolved external symbol "public: class irr::newton::IBody * __thiscall irr::newton::IRagDollBone::getBody(void)" (?getBody@IRagDollBone@newton@irr@@$$FQAEPAVIBody@23@XZ)
project error LNK2001: unresolved external symbol "public: class irr::newton::IBody * __thiscall irr::newton::IUtils::launchCube(void)" (?launchCube@IUtils@newton@irr@@$$FQAEPAVIBody@23@XZ)
project error LNK2001: unresolved external symbol "public: class irr::newton::IBody * __thiscall irr::newton::IWorld::createBodyAuto(class irr::scene::ISceneNode *,class irr::scene::IMesh *,float,unsigned int,class irr::core::CMatrix4<float>,class irr::core::vector3d<float>,enum irr::newton::E_CALCULATE_OFFSET,enum irr::newton::E_CALCULATE_SIZE)" (?createBodyAuto@IWorld@newton@irr@@$$FQAEPAVIBody@23@PAVISceneNode@scene@3@PAVIMesh@63@MIV?$CMatrix4@M@core@3@V?$vector3d@M@93@W4E_CALCULATE_OFFSET@23@W4E_CALCULATE_SIZE@23@@Z)
project error LNK2001: unresolved external symbol "public: class irr::newton::ICollisionManager * __thiscall irr::newton::IWorld::getCollisionManager(void)" (?getCollisionManager@IWorld@newton@irr@@$$FQAEPAVICollisionManager@23@XZ)
project error LNK2001: unresolved external symbol "public: class irr::newton::IMaterial * __thiscall irr::newton::IWorld::createMaterial(void)" (?createMaterial@IWorld@newton@irr@@$$FQAEPAVIMaterial@23@XZ)
project error LNK2001: unresolved external symbol "public: class irr::newton::IRagDoll * __thiscall irr::newton::IWorld::createRagDoll(struct irr::newton::SRagDoll)" (?createRagDoll@IWorld@newton@irr@@$$FQAEPAVIRagDoll@23@USRagDoll@23@@Z)
project error LNK2001: unresolved external symbol "public: class irr::newton::IRagDollBone * __thiscall irr::newton::IRagDoll::findBone(int)" (?findBone@IRagDoll@newton@irr@@$$FQAEPAVIRagDollBone@23@H@Z)
project error LNK2001: unresolved external symbol "public: class irr::newton::IUtils * __thiscall irr::newton::IWorld::getUtils(void)" (?getUtils@IWorld@newton@irr@@$$FQAEPAVIUtils@23@XZ)
project error LNK2001: unresolved external symbol "public: class irr::scene::ISceneNode * __thiscall irr::newton::IUtils::buildDefaultRagdoll(class irr::core::vector3d<float>,class irr::video::ITexture *)" (?buildDefaultRagdoll@IUtils@newton@irr@@$$FQAEPAVISceneNode@scene@3@V?$vector3d@M@core@3@PAVITexture@video@3@@Z)
project error LNK2001: unresolved external symbol "public: struct irr::newton::SIntersectionPoint __thiscall irr::newton::ICollisionManager::getCollisionFirstPointEx(class irr::core::line3d<float>)" (?getCollisionFirstPointEx@ICollisionManager@newton@irr@@$$FQAE?AUSIntersectionPoint@23@V?$line3d@M@core@3@@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IBody::setMaterial(class irr::newton::IMaterial *)" (?setMaterial@IBody@newton@irr@@$$FQAEXPAVIMaterial@23@@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IMaterial::setElasticity(class irr::newton::IMaterial *,float)" (?setElasticity@IMaterial@newton@irr@@$$FQAEXPAV123@M@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IMaterial::setFriction(class irr::newton::IMaterial *,float,float)" (?setFriction@IMaterial@newton@irr@@$$FQAEXPAV123@MM@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IMaterial::setSoftness(class irr::newton::IMaterial *,float)" (?setSoftness@IMaterial@newton@irr@@$$FQAEXPAV123@M@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IRagDoll::addForceContinuousToBones(class irr::core::vector3d<float>)" (?addForceContinuousToBones@IRagDoll@newton@irr@@$$FQAEXV?$vector3d@M@core@3@@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IRagDoll::setAutoFreezeToBones(bool)" (?setAutoFreezeToBones@IRagDoll@newton@irr@@$$FQAEX_N@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IRagDoll::setFreezeToBones(bool)" (?setFreezeToBones@IRagDoll@newton@irr@@$$FQAEX_N@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IRagDoll::setMaterialToBones(class irr::newton::IMaterial *)" (?setMaterialToBones@IRagDoll@newton@irr@@$$FQAEXPAVIMaterial@23@@Z)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IWorld::drawAllDebugInfos(void)" (?drawAllDebugInfos@IWorld@newton@irr@@$$FQAEXXZ)
project error LNK2001: unresolved external symbol "public: void __thiscall irr::newton::IWorld::update(void)" (?update@IWorld@newton@irr@@$$FQAEXXZ)
project fatal error LNK1120: 21 unresolved externals
I assume it's something very basic, but i just can't find it. Any help would be most appreciated.
nano
Posts: 25
Joined: Mon May 07, 2007 1:12 pm

Post by nano »

I still haven't figured this out, does anyone know what would cause this sort of thing?

Am i doing something obviously wrong?
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

So you mean you can use a third-party physics engine but only to compute the collisions. When you said you can't use third-party I took that for meaning "not at all" (for embedded stuff or something).

If you just want the collisions I would advise looking at Opcode (as rogerborg mentioned) as it's sounds exactly what you need. If you had chosen ODE as your physics engine you'd probably have used Opcode with it anyway.
1-Up
Posts: 4
Joined: Wed Oct 17, 2007 9:29 am

Post by 1-Up »

Hi, I'm currently in a similar situation to nano (Got a project where I need to find the exact point of collision between two objects)

I have so far used irrEdit to create the majority of my objects (hence I have been saving them as .irr files) and I used the same bit of code as nano to load in the .irr scenes into irrlicht (thanks to christian again for that :D)

Anyway i've been reading the documentation for opcode and been playing around with its example and so far it seems quite promising in being able to achieve what i'm after. I have some irrlicht related question about opcode though.

From reading the documentation I sort of understand the basis of how to use the API (ie. create colliders for each kind of query) but how does opcode know how to use what kind of mesh? ( Or in mine and nano's case, irrlicht meshes) Also I was wondering if anybody knew of any examples of opcode use in irrlicht?

Any help will be much appreciated
nano
Posts: 25
Joined: Mon May 07, 2007 1:12 pm

Post by nano »

I guess if there was some sort of example code for Opcode usage in Irrlicht then i'd be inclined to go with that option.

So can anyone help with my irrNewt dll compiling errors or link some sort of example of Opcode in use?

I couldn't really figure out how to use Irrlicht's octtrees or nodes to be used as the Opcode Meshes.

Thanks in advance for any help you can give.
nano
Posts: 25
Joined: Mon May 07, 2007 1:12 pm

Post by nano »

bump for any help with an opcode example in irrlicht or a reasoning why my irrnewt will be giving me these errors when i try to compile!
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Bullet has a collider only library with ray / obj and obj/obj collision detection (its easy to use too).
"Irrlicht is obese"

If you want modern rendering techniques learn how to make them or go to the engine next door =p
nano
Posts: 25
Joined: Mon May 07, 2007 1:12 pm

Post by nano »

Hmm, a quick search turned up a few Bullet examples, so i guess i'll check that out, thanks.
Post Reply