UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


A Little Project

power_settings_newLogin to reply
2 posters

descriptionA Little Project - Page 2 EmptyRe: A Little Project

more_horiz
Double check the listing and watch the video that you link.
If you want to use unity least you have to learn the syntax for the scripts. Very Happy

https://www.youtube.com/watch?v=DaE6L2OMi60

descriptionA Little Project - Page 2 EmptyThanks!

more_horiz
Will do, thanks!

descriptionA Little Project - Page 2 EmptyNext Phase

more_horiz
Now I just need a script for the camera. I would like it to follow the player around the way it would in a third person RPG.
Thanks, and sorry if I'm mooching off of your knowledge, I'm not trying to. I plan on learning CSharp from scratch after I finish this project and before I try to make any more games; I think I'm getting closer to done with this project. Again I hope I'm not bothering you and I'm not trying to use you or anything like that; if i knew how to make credits for the game I'd put your screen name in them! [-=

descriptionA Little Project - Page 2 EmptyRe: A Little Project

more_horiz
Hello
You must not in any way enter any credit.
try if you like this script for Maincamera.
Wink



Code:


/*
**************************
      FollowCamera
**************************
*/
public var distance = 10;
public var targetHeight = 2.0;
private var target : Transform;
private var x = 0.0;
private var y = 0.0;
 
function Start () {
  
    target = GameObject.FindGameObjectWithTag("Player").transform;
    var angles = transform.eulerAngles;
    x = angles.x;
    x = 25;
    y = angles.y;
    
}
 
function LateUpdate () {
   if(!target)
      return;
      y = target.eulerAngles.y;
 
   var rotation:Quaternion = Quaternion.Euler(x, y, 0);
   transform.rotation = rotation;

   var position = target.position - (rotation * Vector3.forward * distance + Vector3(0,-targetHeight,0));
   transform.position = position;
 
}

descriptionA Little Project - Page 2 EmptyAwesome! Just Trying to fix Errors

more_horiz
Thanks a ton for the code, and don't worry I won't do any credits now that you told me not to.

So I pasted the script into my PlayerController script, and the thing I'm using for the script, the Unity MonoDevelop, seems to have a problem with the 'var' in 'public var distance = 10;' and this seems to produce 3 different errors. When I hover my cursor over the red line underneath the 'var' it says "unexpected symbol 'var' expecting 'class', 'delegate', 'enum', 'interface', 'partial', or 'struct'" so my question is, which one should I pick and try out for this instance and this script: class, delegate, enum, interface, partial, or struct?
Also, am I supposed to attach this script to the PlayerController script? Did I get that right?

Thanks again help forum buddy! [-=

PS can I give you credit for all the code and help you gave me as far as just telling people, like when I say 'hey I made this little game' can I add something like 'but I couldn't have done it without so-and-so's help from the help forum'?

descriptionA Little Project - Page 2 EmptyRe: A Little Project

more_horiz
No this is one java script is pasted into a new Java script name you want.
and then drag in MainCamera.
and it's done.
Regards

descriptionA Little Project - Page 2 EmptyAwesome

more_horiz
It worked, thanks! [-= I didn't know you could have different scripting languages work together like that-neat! [-=

descriptionA Little Project - Page 2 EmptyFinished!

more_horiz
The game is done! Thanks so much again for all your help, and unless you don't want me to I'll tell everyone that I show/mention the game to that I couldn't have done it without all your help! Very Happy

descriptionA Little Project - Page 2 EmptyRe: A Little Project

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply