FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Distance / Ray based Camera - No Rigid bodies

2 posters

Go down

Distance / Ray based Camera - No Rigid bodies Empty Distance / Ray based Camera - No Rigid bodies

Post  swebal Thu Oct 08, 2009 3:33 am

Hi all,

I've been searching for forums for some implementation of using a distance ray for the camera instead of a ridig body and found to following links:

Collision with object and object

Collision with custom methods for camera

, both of which seems to suit me very well. However... I can't seem to get the callback to fire? I created a sensor inside the templateLoading method with the distance method from link#2 as follows:

Code:

SIO2object *myplane = sio2ResourceGetObject( sio2->_SIO2resource, "object/Plane");
sio2CameraSensorInitDistance("Camera2Plane", myplane, 2.0f, mySIO2sensordistance);

and lifted the same method from link#1 and put it in my template.mm (& .h) file:

Code:

void mySIO2sensordistance ( void *_ptr ,float _dist)
{
   SIO2sensor *sender = (SIO2sensor *)_ptr;
   
   if (sio2StringCmp(sender->name, "Camera2Plane"))
   {
      printf("Sensor target_dist!\n");
   }
}

, which doesn't seemed to be called.

My goal is to create my own gravity using a distance ray to all the objects instead of a rigid body. Since I'm only trying to implement "standard first person movement", I believe using rays will give the best performance, am I wrong?

Any help with this is much appreciated! Thanks!

swebal

Posts : 5
Join date : 2009-10-08

Back to top Go down

Distance / Ray based Camera - No Rigid bodies Empty Re: Distance / Ray based Camera - No Rigid bodies

Post  swebal Thu Oct 08, 2009 3:37 am

Actually, the method I lifted (sensor method) uses a rigid body, which is "bad" I guess. How would I create a "normal" ray (pointing down -Z) for the camera and detect the distance to any object hit?

I know, newbie question, but I'm not very familiar with c++, only c# and cocoa, so this is all quite new to me...

Thanks for any advise (aside from learning c++ before I post here again)!

swebal

Posts : 5
Join date : 2009-10-08

Back to top Go down

Distance / Ray based Camera - No Rigid bodies Empty Re: Distance / Ray based Camera - No Rigid bodies

Post  swebal Thu Oct 08, 2009 3:48 am

Don't mind me yet, I think I found something in tutorial9...

swebal

Posts : 5
Join date : 2009-10-08

Back to top Go down

Distance / Ray based Camera - No Rigid bodies Empty Re: Distance / Ray based Camera - No Rigid bodies

Post  swebal Thu Oct 08, 2009 4:58 am

I got it to work using the ray stuff from tutorial9... Smile

I have to just say though, SIO2 RULES! I took a day studying Unity3D, trying to make the models from Blender render correctly, applying textures over and over again... SIO2 worked the first time, matching Blender OpenGL to the pixel. Simply amazing work!

swebal

Posts : 5
Join date : 2009-10-08

Back to top Go down

Distance / Ray based Camera - No Rigid bodies Empty Re: Distance / Ray based Camera - No Rigid bodies

Post  Francescu Thu Oct 08, 2009 8:01 am

swebal wrote:I got it to work using the ray stuff from tutorial9... Smile

I have to just say though, SIO2 RULES! I took a day studying Unity3D, trying to make the models from Blender render correctly, applying textures over and over again... SIO2 worked the first time, matching Blender OpenGL to the pixel. Simply amazing work!
Yes, SIO2 is a great engine along with its amazing resources.

Please make sure to support this project when you can by purchasing an indie license (cheap) and / or Rom's meditation garden source code, as well as spreading the word...

As you know this is all great but as always all of this did not come free for the person (Rom) who gave us this great engine in the first place.

Cheers and welcome

--Franky

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

Distance / Ray based Camera - No Rigid bodies Empty Re: Distance / Ray based Camera - No Rigid bodies

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum