Stratos: Punto de Encuentro de Desarrolladores

¡Bienvenido a Stratos!

Acceder

Foros





Input Handling

Iniciado por auron, 02 de Febrero de 2006, 06:29:57 AM

« anterior - próximo »

auron

 Hi,

Not sure if anyone has posted this before cos I can't read a lot of the posts... I don't speak spanish... =)

Is it possible to customise my input behaviour?
Like to override the standard FPS camera style and implement custom camera controls?

Haddd

 Of course you can, but may be what you need it's already implemented...

What do you really need? May be it can be interesting for a new tutorial....

auron

 For instance, if I want to create a top down shooter or something like that, where up, down, left and right would shift the camera on a horizontal plane and keep it facing down.

By the way, I tried using the LookAt() function for the camera, it doesn't seem to work. Am I doing something wrong? Using the Rotate and RotateStep functions works but LookAt() doesn't.

Also, any idea on how to lock the camera on a specific object? I was experimenting and trying to lock my camera on to a particular object to rotate around it when I moved my mouse.

Haddd

 Ok, you only need to set the Haddd.Scene.Camera.Position values, and set the :

((HFirstCameraPerson)Haddd.Haddd.Scene.Camera).UseInput=false;

This tells the engine that the input device will not be used, so you must set the:

Position

Angles ( usign Euler angles) or Rotation ( using Quaternions)

The LookAt is very easy. You only need to attach it to the node you are looking. See the Joints and Scenegraph tutorial. The camera is a node too, so you can attach it to another node.

If you have problems, give me the code and i make a tutorial.  ;)

Vicente

 Just in case no one noticed: Haddd loves doing tutorials ;) Greetings!

Vicente

auron

 Ahhh I see... I got it thanks... =)

But one thing, do I create a new node and attach the camera to it?
Is there a factory method to create nodes or i just declare it with new HNode?

Hahaha... Haddd's the tutorial guru!

By the way does the engine have ray casting capabilities? So I can pick objects using ray scene queries.

Haddd

 See the joints and scenegraph tutorial...that's all you need. Maybe you have a tank on your game, so create it with:

Haddd.Scene.MeshObjects.Create("tank","true);

And attach it the camera.

CitarBy the way does the engine have ray casting capabilities? So I can pick objects using ray scene queries.

Of course, just look at the Tut-18. I am not a ghost(the collision world tutorial) to see some code about ray casting. Newton it's great on it too... (genial)  

BeRSeRKeR

 If you want your camera to always have the same angles, the only thing you have to do is specify these angles through the "Angles" camera property and move the camera wherever you want.

But if what you want is your camera to look constantly to a node, then use the LookAt method and pass the node you want to look at as parameter. This node could be anything that derives from the Node class (HMeshObject, HLight, HParticleEffect, etc).

¡Si te buscan en nombre de la ley, huye en nombre de la libertad!!

auron

 Cool stuffs...
I know about the LookAt function... It works on all the objects/nodes ive tried it on... I was just puzzled as to why it didn't work on the main scene camera. When i put in Haddd.Scene.Camera.LookAt(cube), it doesn't affect the camera at all...

Is there some trick to get it to work?

Thank for all your help guys... Really appreciate it...
And I think you've done some great work with this engine. =)

BeRSeRKeR

 
Cita de: "auron"I know about the LookAt function... It works on all the objects/nodes ive tried it on... I was just puzzled as to why it didn't work on the main scene camera. When i put in Haddd.Scene.Camera.LookAt(cube), it doesn't affect the camera at all...
You're right, for some reason we are still calculating the camera view matrix in base to the angles/quaternion the user specify, instead of using the inverse of the camera world matrix that takes into account the look-at controller (if any exists).

We'll try to fix this as soon as possible.

Greets.
¡Si te buscan en nombre de la ley, huye en nombre de la libertad!!

auron

Cita de: "BeRSeRKeR"You're right, for some reason we are still calculating the camera view matrix in base to the angles/quaternion the user specify, instead of using the inverse of the camera world matrix that takes into account the look-at controller (if any exists).

We'll try to fix this as soon as possible.

Greets.
Great..  :D
One bug down! (ole)

Haddd

 I've modified the 16 tutorial, and added an example about how to create a camera class...

I expect to upload the new code tomorrow... :P


auron

 Great!
You da man Haddd. (ole)  

Haddd

 New version Updated  (ole)  






Stratos es un servicio gratuito, cuyos costes se cubren en parte con la publicidad.
Por favor, desactiva el bloqueador de anuncios en esta web para ayudar a que siga adelante.
Muchísimas gracias.