This project is read-only.

Engine Camera Function

Jan 2, 2011 at 12:49 AM
Edited Jan 2, 2011 at 2:13 AM

Is there any documentation explaining how the engines built in camera functions work/are called? I'm trying to implemented basic camera control into my demo but I can't seem to figure out how the calls work.

Assuming one wanted to edit the engines camera functions, would they need to edit the source code, recompile, and then implement or is there a modular way to do so? I guess an alternative is also to simply build one from scratch.  I'm drawing a blank at the moment to be honest, I'm not sure how various camera tutorials on the web (which deal with "new projects") can be applied to a levels architecture in Ox. I'm sure with some rest and reflection it should click in.

Edit: Just realized level scripting and such is handled through class files and not GameScript.cs! This should make the camera implementation a bit easier once I've figured out how it will all flow together. But this would mean the camera scripts would need to be called in each file? Would it be easier to use Ox's built in features for this?

Jan 4, 2011 at 10:12 PM

did you want one single controllable camera? or did you want a camera that is controlled individually by different scripts?

the camera is quite easy to use (although i haven't done any coding for about 6 months so i might take a while to work it out again :P )

-bubzy

Jan 5, 2011 at 12:01 AM

Thanks for your responses,

I'm thinking a single controllable camera will do, the only trouble so far is getting any type of camera to work. 

Jan 9, 2011 at 1:35 AM

Bubzy,

Thanks for your help but assuming you were looking a solution won't be necessary. Ox likely won't be used.

Thanks again,

Jan 9, 2011 at 6:54 AM

Engine.Camera.Blah from pretty much any script, or, well, anywhere at all.

Jan 9, 2011 at 5:18 PM
Edited Jan 9, 2011 at 5:20 PM
bryanedds wrote:

Engine.Camera.Blah from pretty much any script, or, well, anywhere at all.

 I think I'm on the right track now but I'm getting the following error when attempting to load an object that would take on the camera.

"Cannot cast item Camera.Main to type BasicModel."

Code:

 

 

 BasicModel Camera = Engine.GetScript<BasicModel>("Camera.Main");

Engine.Camera.SetTransformByLookTarget(

new Vector3(169, 647, -998), 

 

 

 Vector3.Up, Camera.Position);

The code is being implemented directly into the first level "case" in gamescript.cs.