• 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 /
avatar image
0
Question by Bengooch7 · Aug 19, 2015 at 05:13 PM · animationcameramovement

problems with using a camera as a texture

I'm trying to prototype out an idea that uses a flattened cube as the characters in my game. Above ground (what the player will see) is a flattened cube with the texture being the view of an Orthographic camera which is attached to a 3d modeled character (currently a free asset from the store as a stand-in). This gives the cube that the player sees the impression of a flat paper character but the character will rotate in full 3d rotation instead of having to use a billion sprites for each character to show each degree of rotation for every animation that the player character could possibly do at each degree of rotation.

Above Ground view

Below Ground view

The cube is fixed to always face the camera and the camera is fixed to the cube so it never rotates either. It's similar, I suppose, to paper Mario, if Mario was drawn to show him facing 360 degrees instead of maybe 8 positions.

The problem I'm running into is the texture is showing artifacts around the character on the cube texture even though I have the camera culling out everything except the 3d model. Also, I may just not know how to make things play the correct animation (walking) when I have the cube move. I'd like for the cube to show the 3d model walking when the cube moves.

I have a script attached to the cube for the cube to move anywhere the player clicks on the ground.

Here's the script:

 #pragma strict
 //MoveToClickPoint.js
 var agent: NavMeshAgent;
 var speed : float;
 
 //var playerPOS : Vector3;
 //var relCameraPos : Vector3;
 //var player : Transform;
 
 
 
 function movePlayer() {
     if (Input.GetMouseButton(0)) {
         var hit: RaycastHit;
         
         if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit, 2000)) {
             agent.destination = hit.point;
         } if (Input.GetMouseButtonUp){
         
         }
     }
 }
 
 
 
 
 function Start() {
     agent = GetComponent.<NavMeshAgent>();
     
 }
 
 
 function Update() {
     transform.eulerAngles.y = 0;
     movePlayer();
     //getTouchPosition();
 }

Does anyone know why the texture is showing artifacts in the background of the character, or have any suggestions on how to improve on this idea?

Thank you all!

projectabove-ground.jpg (451.5 kB)
projectbelow-ground.jpg (313.1 kB)
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
1
Best Answer

Answer by FortisVenaliter · Aug 19, 2015 at 08:14 PM

Because your clear flags for that camera are set to depth only. So, when the view changes, it won't clear out the color buffer. What you probably want is to have it clear to transparent black (but you can't use full transparency), so I'd suggest having it clear to a solid color, that color being (0,0,0,1/255f)

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

25 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

Related Questions

Having Trouble animating camera at start of game 1 Answer

End of Animation 1 Answer

2D Diablo style movement 1 Answer

scripting for animation 0 Answers

Move a Game Object (Camera) forward and sideways with the Mobile Sensor Outputs. How? 0 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