Camera like RPG

hello,



I need to create a camera like the RPG … When the User clicks on a model of the scene, this model moves according to the movement of the muse and the camera is following the model …



how I do it?



thanks

You mean like a chase camera?

Sort of. I think what he really wants is the complete camera and movement system of Diablo. Am I right? If you’re trying to copy something you’ve seen in an existing game, you might as well post a video of it so there’s no doubt about what you’re after.

i wanna do like Caesar IV:



http://www.youtube.com/watch?v=w81Q8xcS-6Q



and I’ll merge camera FPS and camera RPG (like this example) , in my game.



that there will be no mouse pointer, but that sight with the symbol “+” example of HelloPick.class.





thanks

It looks like a flycam :stuck_out_tongue:

Or maybe a flycam pointed at an invisible focus point that rides the terrain? It’d almost be as simple as a node that you can move, with a chasecam attached to it.



~FlaH

ok



but how to make the camera move like this video? Flycam and chasecam moves so automatically?



I need the camera moves along with the model according to mouse movement …

Create a node, use this node as the target for your camera to look at, place your camera at the right angle and distance from this point.

On every update, get the mouse movement (while dragging that is) and dependent on the direction the camera is facing, move the node stated above. After this move, use a ray or heightmap to change the y position of this node accordingly, that way it will follow the terrain.



For the camera following the node, you may use the chaseCam whithout an inputmap, using functions that set the ‘default’ rotation of the camera the way you want it to be. The camera will follow the node automatically then so you will only have to move the node. Note that this is not the way chaseCam was intended to be used, but it works as a start.

1 Like

thanks,

I’ll try it!



but, I’m using JME3 and saw that no chasecam for version 3 of the engine …



I looked at this link:



http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/cameracontrol-and-chasecamera/




it contains the class chasecam to jme3.



You advise me to use it? This class is stable? Or is there another one that I use?

It is in JME3, try typing chaseCam in JMP on a new line and hit ctrl+shift+i, JMP will find it for you.

[java]chaseCam = new ChaseCamera(cam, camTargetNode, inputManager);[/java]

dosent work :confused:







still showing that the class does not exist … JMonkey platform dosent offers option to import Chasecam …



I’m using the JMonkey Platform alpha 2





you know what’s wrong?

Alpha2? Alpha-4 is coming out tomorrow xD

Try updating it? (I don’t know how to do it with NetBeans, but with Eclipse you just right click on the class and press, “Refresh”)



Yeah, you should probably start using Alpha 3…

Tomorrow Alpha-4 will be available for download?



So I will leave to download the 4 tomorrow hehehhe



tomorrow I’ll try that baalgarnaal said, using the Alpha-4!

Tomorrow? Holy macro, I got too much too do already! Can I stall the release?

hi,



I downloaded the JMonkey Platform alpha-3 and managed to make chasecam …



the camera sits on top the way I want, but I sent the model in X always move within the “simpleUpdate (float tpf)” and the object does not move and the camera stays in the same place:



[java]

cadeira.attachChild(makeCharacter());

ChaseCam chaseCam = new ChaseCamera(cam, cadeira, inputManager);

chaseCam.setDefaultDistance(10) ;

chaseCam.setDefaultHorizontalRotation(7);[/java]



[java]@Override

public void simpleUpdate(float tpf)

{

Vector3f camDir = cam.getDirection().clone().multLocal(0.2f);

Vector3f camLeft = cam.getLeft().clone().multLocal(0.2f);

cadeira.setLocalTranslation(x+0.5f,y,z); //the model should be movement on the axis X. …

walkDirection.set(0, 0, 0);

if (left) { walkDirection.addLocal(camLeft); }

if (right) { walkDirection.addLocal(camLeft.negate()); }

if (up) { walkDirection.addLocal(camDir); }

if (down) { walkDirection.addLocal(camDir.negate()); }

player.setWalkDirection(walkDirection);

cam.setLocation(player.getLocalTranslation());

}[/java]



and when I click with mouse and move the mouse, the camera moves together , but the model still continues …



I’m trying but I’m not getting it :confused:



thanks

try this in line 6:

[java]

cadeira.getControl(CharacterControl.class).warp(new Vector3f(x+0.5f,y,z));

[/java]

ok



I managed to make the model move … but can not make it move according to mouse movement …

How do you want it to move according to the mouse movement? Where your mouse pointer is, that’s where you want the model? It shouldn’t be that hard… Just use a listener to find the location of the mouse pointer…

Excuse me the delay in responding, but I have only the weekends to work in this project …



i dont know how to get the mouse position to be able to move the model according to the mouse position … tried here in the forum and not found …



please, give me an example of get the position of the mouse pointer …



thanks