Jump to content



Photo

Camera follow path


  • Please log in to reply
3 replies to this topic

#1 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 19 July 2015 - 01:58 AM

I have been practicing transforming objects and ended up trying to do stuff with camera.

transform.Rotate(Vector3.right, 45, Space.World);

I'm grasping how to do the standard stuff like the above, but how to get the camera follow a complex path around an object or table ?

 

I've come across a class that uses objects to set waypoints. http://wiki.unity3d....line_Controller

 

This is my attempt, it doesn't work, but it doesn't crash, so I must be warm. :) Wondering if it knows where the main camera is.

        SplineController zeroidModel = GameObject.Find("Ornament11").AddComponent<SplineController>();        
        GameObject.Find("Cam1").transform.parent = zeroidModel.transform;
        GameObject.Find("Cam2").transform.parent = zeroidModel.transform;
        GameObject.Find("Cam3").transform.parent = zeroidModel.transform;
        GameObject.Find("Cam4").transform.parent = zeroidModel.transform;
        zeroidModel.SplineRoot = GameObject.Find("Ornament16");
        zeroidModel.AutoStart = true;

There's any way to use classes outside of a script? I have just thrown in all 3 classes to the script to test.

 

Have I come across a look at translite method or similar? I'm sure there was one..


Edited by chepas, 19 July 2015 - 02:00 AM.

Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#2 BilboX

BilboX

    Enthusiast

  • Unit3D Pinball Team
  • 433 posts
  • Location:French Polynesia

  • Flag: France

  • Favorite Pinball: Metallica, Addams Familly, Scared Stiff, White Water

Posted 19 July 2015 - 10:13 AM

Ow. That will be complicated I guess. not sure the CameraManager will let teh Camera beeing handled by another script (Louizou wrote it).

if I remember right, i did something siomilar grabbing the camera and translate/rotate slowly to show the back glass in Scared Stiff: This induced a bug but I did not had time to fix it.

 

Yes, only one script is anoying: I changed that for Beta2 ;). Also, the compiler used will be c# 3.5, (was 2.0) which mleans you will be able to use predfeined valuesin constructor, etc...

 

Take a look at ScaredStiff's script.

 

Also, the main camera (desktop), can be cought by (you need the transform to move it I guess):

GameObject.Find("CAMERAS/UserCams/Camera").transform

But remember that this will not work in Cab mode of course...


UP2


#3 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 19 July 2015 - 01:14 PM

Scared Stiff must've been where I've picked up the mystery method "LookAtTranny".

 

Maybe we can just invoke the "TAB" key camera?

transform.Rotate(Vector3.right, 45, Space.World);

This will rotate a camera. This has to be the main camera or is this rotating the player? I did this one by accident which incidentally opened a can of worms.

 

 

Yes, only one script is anoying: I changed that for Beta2 ;). Also, the compiler used will be c# 3.5, (was 2.0)

Nice. I can see in future if procgame comes into play one script will be a mess and difficult to get around once you start building a game. Modes organized as separate classes is what I've got used too a lot.


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#4 BilboX

BilboX

    Enthusiast

  • Unit3D Pinball Team
  • 433 posts
  • Location:French Polynesia

  • Flag: France

  • Favorite Pinball: Metallica, Addams Familly, Scared Stiff, White Water

Posted 19 July 2015 - 02:35 PM

I indeed added multiple classes support for netprocgame. But remember: you will have to remove your sln from the table dirt as all cs in tablme hierarchy will be compiled...

 

Yes I will have to trigger the "look at translite" action in scared stiff...


UP2