Foros - Stratos

Proyectos => Jad Engine => Mensaje iniciado por: auron en 02 de Febrero de 2006, 06:29:57 AM

Título: Input Handling
Publicado por: auron en 02 de Febrero de 2006, 06:29:57 AM
 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?
Título: Input Handling
Publicado por: Haddd en 02 de Febrero de 2006, 08:08:40 AM
 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....
Título: Input Handling
Publicado por: auron en 02 de Febrero de 2006, 09:20:42 AM
 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.
Título: Input Handling
Publicado por: Haddd en 02 de Febrero de 2006, 09:42:20 AM
 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.  ;)
Título: Input Handling
Publicado por: Vicente en 02 de Febrero de 2006, 10:59:48 AM
 Just in case no one noticed: Haddd loves doing tutorials ;) Greetings!

Vicente
Título: Input Handling
Publicado por: auron en 02 de Febrero de 2006, 11:20:28 AM
 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.
Título: Input Handling
Publicado por: Haddd en 02 de Febrero de 2006, 11:42:34 AM
 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)  
Título: Input Handling
Publicado por: BeRSeRKeR en 02 de Febrero de 2006, 12:51:46 PM
 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).

Título: Input Handling
Publicado por: auron en 02 de Febrero de 2006, 12:56:12 PM
 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. =)
Título: Input Handling
Publicado por: BeRSeRKeR en 02 de Febrero de 2006, 01:10:47 PM
 
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.
Título: Input Handling
Publicado por: auron en 02 de Febrero de 2006, 01:23:42 PM
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)
Título: Input Handling
Publicado por: Haddd en 03 de Febrero de 2006, 12:17:03 AM
 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

Título: Input Handling
Publicado por: auron en 03 de Febrero de 2006, 03:28:53 AM
 Great!
You da man Haddd. (ole)  
Título: Input Handling
Publicado por: Haddd en 03 de Febrero de 2006, 10:01:47 AM
 New version Updated  (ole)