Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by afriendlycow · Sep 28, 2016 at 08:42 PM · erroreditor-scriptingeditorwindow

I really need some help and it's frustrating

I cannot fix the Main Camera I tired last night stay up 1am and now it's just getting frustrating for past month as I am focus on this project, but stuck on it. The main camera distorts everything and I even get compiler errors had delete the checkpoint script. I did checkpoint script again of retyped it and failed ten more times. Hours on endless research, As I tried to create checkpoints of other ways that won't work either. I don't know what to do anymore. I am a noob at scripting in Unity, but not totally of a noob as I am somewhat experienced at scripting.

My list things to do is Fix the Main Camera, Checkpoints, fix animator, and DONE.

Where I found Checkpoints lastest one: Video: https://youtu.be/X11SBMwegaA

What information you'll need to know? I've made a video https://youtu.be/GsIK6UZ1jT8

AND

The Main Camera Script: Script Name: SmoothFollow.cs

using UnityEngine; using System.Collections;

public class SmoothFollow : MonoBehaviour { public Transform target; public float smoothDampTime = 0.2f; [HideInInspector] public new Transform transform; public Vector3 cameraOffset; public bool useFixedUpdate = false;

private CharacterController2D _playerController; private Vector3 _smoothDampVelocity;

void Awake() { transform = gameObject.transform; _playerController = target.GetComponent(); }

void LateUpdate() { if( !useFixedUpdate ) updateCameraPosition(); }

void FixedUpdate() { if( useFixedUpdate ) updateCameraPosition(); }

void updateCameraPosition() { if( _playerController == null ) { transform.position = Vector3.SmoothDamp( transform.position, target.position - cameraOffset, ref _smoothDampVelocity, smoothDampTime ); return; }

if( _playerController.velocity.x > 0 ) { transform.position = Vector3.SmoothDamp( transform.position, target.position - cameraOffset, ref _smoothDampVelocity, smoothDampTime ); } else { var leftOffset = cameraOffset; leftOffset.x *= -1; transform.position = Vector3.SmoothDamp( transform.position, target.position - leftOffset, ref _smoothDampVelocity, smoothDampTime ); } }

}

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by nathanthesnooper · Sep 28, 2016 at 09:44 PM

Hit the code button to show code so it's easier for us to read.

Does your camera look distorted when you move it when your game is not being played? By the way, this could be a bug for your OS. It seems to not make a difference in game, only scene view

EDIT: Ok, now i see it. try going to the camera component on your camera, and hitting the gear on the top-right. Click reset. Be careful if you set any values earlier you don't forget to set them back.

2:52 on the video: Change the z-value for your player to a lower value to make it go on front (reversed order)

-if your player then disappears, change the camera

EDIT: at 3:14, make sure the rock does not have collisions enabled (the component)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

95 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't update ObjectField after object is selected 1 Answer

Changes to asset data persist - unable to discard changes 1 Answer

EditorWindow and serialization of scene objects 0 Answers

UIElements Uss Selectors 1 Answer

How to change the text of EditorGUILayout.TextField 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges