Camera modes and control objects
by J · in Torque 3D Professional · 11/04/2009 (1:07 pm) · 9 replies
I've been digging on this new camera system for the last week and I've come up with a nice 3D side scroller type camera..pretty cool; but what I really want is a Assasin's Creed type camera. So I've got the camera setup in script, but I'm having problems delegating the keyboard versus the mouse:
Got a function: setCamStyle(%style); that runs after the mission is loaded. You can move the player around and the camera follows as static. If I hit alt C, I can move the camera around with the newtonMode and newtonRotation and then alt C again to move the player. (All viewed from the localclientconnection.camera of course)
that's where my problem lies...how do I eliminate the "alt c" toggle. I just want the keyboard to control the player and the mouse to control the camera object...which is orbiting the player.
I have it in my head that all I need to do is create new bindings. I've attempted to create many new actionMaps/GlobalActionMaps with no avail. How do I designate the object the mouse is controlling? I don't understand how the bindings work I guess.
Maybe I need to look at this from a different angle all-together.
Could someone point me in the right direction?
BTW: I do realize there is a lot of resources that solve this problem in c++, but I feel it can be accomplished in script with the new camera system and their isn't much on the forums/docs for that...yet...?
Thanks,
J
www.garagegames.com/community/forums/viewthread/5742
Got a function: setCamStyle(%style); that runs after the mission is loaded. You can move the player around and the camera follows as static. If I hit alt C, I can move the camera around with the newtonMode and newtonRotation and then alt C again to move the player. (All viewed from the localclientconnection.camera of course)
that's where my problem lies...how do I eliminate the "alt c" toggle. I just want the keyboard to control the player and the mouse to control the camera object...which is orbiting the player.
I have it in my head that all I need to do is create new bindings. I've attempted to create many new actionMaps/GlobalActionMaps with no avail. How do I designate the object the mouse is controlling? I don't understand how the bindings work I guess.
Maybe I need to look at this from a different angle all-together.
Could someone point me in the right direction?
BTW: I do realize there is a lot of resources that solve this problem in c++, but I feel it can be accomplished in script with the new camera system and their isn't much on the forums/docs for that...yet...?
Thanks,
J
www.garagegames.com/community/forums/viewthread/5742
About the author
I used to be obsessed with building my own open-ended RPG and a 3D Side Scroller RPG. But the job/house/girlfriend got in the way. I know, I know. Now I concentrate on doing architectural renderings (with the help of T3D of course) and VBA programming.
#3
05/06/2010 (2:41 pm)
I'd be very interested in knowing how you got torque3d on a side scroll camera.
#4
We've looked into this before(http://www.torquepowered.com/community/forums/viewthread/106995), and I don't think script can accomplish this quite yet. However, if you check the "T3D Road Map" thread, you'll hear the following quote about their "sprints":
"For example, the first "rolling update" is very likely going to be focused on making the Camera system more powerful, flexible, and editor friendly." - Matt Fairfax
Here's to hoping it comes sooner rather than later.
-Dan
05/06/2010 (3:07 pm)
J -We've looked into this before(http://www.torquepowered.com/community/forums/viewthread/106995), and I don't think script can accomplish this quite yet. However, if you check the "T3D Road Map" thread, you'll hear the following quote about their "sprints":
"For example, the first "rolling update" is very likely going to be focused on making the Camera system more powerful, flexible, and editor friendly." - Matt Fairfax
Here's to hoping it comes sooner rather than later.
-Dan
#5
You might have to adjust this depending on which axis you would like you player to travel
Then put in your new actionMap bindings
In playgui.cs
Then push the new actionMap when you hit F11 and pop it when you don't need it in playgui.cs
I am putting together a tutorial/kit of all this that will be a lot more effiecent and complex. It will also have some scripted melee functionality that I've been working on. I love the look of trine and I think T3D could pull that off with no problem. I'd also like to get some PhysX items in there, like how to make a bridge and such.
05/06/2010 (3:51 pm)
In default.bind.csYou might have to adjust this depending on which axis you would like you player to travel
function ssmoveforwardLeft(%val)
{
%deg = localclientConnection.player.getEulerRotation();
if (%deg == "0 -0 -0") {
%rotPos = %hero.getTransform();
%lx = getword(%rotPos,0);
%ly = getword(%rotPos,1);
%lz = getword(%rotPos,2);
%rx = 0;//getword(%rotPos,3);
%ry = 0;//getword(%rotPos,4);
%rz = 1;//getwords(%rotPos,5);
%rd = 3.14159;
%lx = 0.8; //makes sure the player stays lined up on the y/z axis
%hero.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd);
}
$mvForwardAction = %val * $movementSpeed;
}
function ssmoveforwardRight(%val)
{
%deg = localclientConnection.player.getEulerRotation();
if (%deg == "0 -0 -180") {
%rotPos = %hero.getTransform();
%lx = getword(%rotPos,0);
%ly = getword(%rotPos,1);
%lz = getword(%rotPos,2);
%rx = 1;//getword(%rotPos,3);
%ry = 0;// getword(%rotPos,4);
%rz = 0;//getword(%rotPos,5);
//%angle += 180;
%rd = 0;
%hero.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd);
}
$mvForwardAction = %val * $movementSpeed;
}*getFowardVector would probably be a better way to handle this.Then put in your new actionMap bindings
sideScrollerMap.bind( keyboard, left, ssmoveforwardLeft ); sideScrollerMap.bind( keyboard, right, ssmoveforwardRight );
In playgui.cs
localClientConnection.camera.setOrbitMode(localClientConnection.player, "0 0" @ mDegToRad(90), 0, 12, 12, false, "0 0 0", false); localClientConnection.setCameraObject(LocalClientConnection.camera); localClientConnection.setControlObject(LocalClientConnection.player); serverConnection.setFirstPerson(false);
Then push the new actionMap when you hit F11 and pop it when you don't need it in playgui.cs
I am putting together a tutorial/kit of all this that will be a lot more effiecent and complex. It will also have some scripted melee functionality that I've been working on. I love the look of trine and I think T3D could pull that off with no problem. I'd also like to get some PhysX items in there, like how to make a bridge and such.
#6
Yeah, we were defenitely frustrated with the camera system. (I've gained more than a few gray hairs with T3D)
This is by no means to be a solid solution. Its just a work around.
Using the script above, you still have the camera jumping to a close up when you are by other objects. That gets real annoying. The camera also bounces with every movement of the player (as it should), but sometimes I get to the point that it is also annoying and should be steady and smooth.
I've found some code for a pathed camera system that I was planning on using for the tutorial, but... as you said about improving the camera system, it would be really nice if I didn't have to find a glitchy work around. I might just use this above so people can at least get the idea and have something to help them out.
I'm really hoping GG can improve on a lot of T3D. Its really a nice engine, I'm just disapointed on how many snags get me. (Yeah, its still in beta) But, at this point, I spend more time trying to find work arounds, than I do building a game. I'm pretty proficient with TorqueScript and still learning C++. But, I'm getting this frustrated? It has to be hell for someone just learning the engine. I think TGB has a lot of the setup that I would like to see in T3D. Namely the partile system that works good.
All in all though, when a stable version comes out, I'm planning on getting GMK and 3DAAK and that will knock out much of my frustration. Until then, artwork, artwork, artwork... (if I don't find snags on that...physX)
05/07/2010 (6:28 am)
@Dan,Yeah, we were defenitely frustrated with the camera system. (I've gained more than a few gray hairs with T3D)
This is by no means to be a solid solution. Its just a work around.
Using the script above, you still have the camera jumping to a close up when you are by other objects. That gets real annoying. The camera also bounces with every movement of the player (as it should), but sometimes I get to the point that it is also annoying and should be steady and smooth.
I've found some code for a pathed camera system that I was planning on using for the tutorial, but... as you said about improving the camera system, it would be really nice if I didn't have to find a glitchy work around. I might just use this above so people can at least get the idea and have something to help them out.
I'm really hoping GG can improve on a lot of T3D. Its really a nice engine, I'm just disapointed on how many snags get me. (Yeah, its still in beta) But, at this point, I spend more time trying to find work arounds, than I do building a game. I'm pretty proficient with TorqueScript and still learning C++. But, I'm getting this frustrated? It has to be hell for someone just learning the engine. I think TGB has a lot of the setup that I would like to see in T3D. Namely the partile system that works good.
All in all though, when a stable version comes out, I'm planning on getting GMK and 3DAAK and that will knock out much of my frustration. Until then, artwork, artwork, artwork... (if I don't find snags on that...physX)
#7
I've moved myself to a 2D project in the meantime, hoping that T3D will be totally ripe when I finish my 2D platformer game. I'm digging the setup of TGB a whole bunch, really, and I can't wait to start working on assets and art again!
05/07/2010 (10:29 am)
3daak would be really awesome if it weren't soooo damn expensive. I think the mod they did is probably well worth the money if you plan to use a portion of their features, but for me, I'd only need a small handful.I've moved myself to a 2D project in the meantime, hoping that T3D will be totally ripe when I finish my 2D platformer game. I'm digging the setup of TGB a whole bunch, really, and I can't wait to start working on assets and art again!
#8
I've really considered doing that as well. TGB is looking more and more appealing all the time. Do we get the discount on T2D if we buy TGB? I seen the question asked, but never an answer.
05/07/2010 (12:39 pm)
Agreed, 3DAAK is expensive... still!I've really considered doing that as well. TGB is looking more and more appealing all the time. Do we get the discount on T2D if we buy TGB? I seen the question asked, but never an answer.
#9
all I know is T2D will be perhaps too awesome.
05/07/2010 (1:33 pm)
Yes, it will have some sort of upgrade scheme, whether it's a direct discount or adjusted, I dunno.all I know is T2D will be perhaps too awesome.
Torque Owner J
Act 7