Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by Alan Fletcher · Feb 22, 2013 at 06:53 PM · c#fps

How to draw an arrow from fps contoller

hello I would like to know how to attach an arrow to show what direction the fps controller is facing. I am using the below method to get the power I will use to throw the stone. The directional arrow is so i can see what direction the fps controller is facing when I switch the camera view so i still know what direction ill be throwing the mentioned stone. The stone is an object that is thrown at targets.

  void OnGUI() {
         hSbarValue = GUI.HorizontalScrollbar(new Rect(25, 25, 100, 30), Mathf.PingPong(Time.time*5.0f, 19), 1.0F, 0.0F, 19.0F);
     }


I would also like the arrow to change the its size depending on the power off that method.

I dont have a clue how to do this so any help would be appreciated.

Thanking you

Comment
Add comment · Show 1
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
avatar image Khada · Feb 22, 2013 at 06:54 PM 0
Share

"throw the stone" - What stone?

Please watch this and make your question clearer: http://video.unity3d.com/video/7720450/tutorials-using-unity-answers

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by robertbu · Feb 22, 2013 at 07:47 PM

As a starting point, scale a box to (0.1, 0.1, 1) or whatever works with your scene. You want it long on the Z axis. Place this in front of your character so that it is pointing forward. Make this a child of the game controller object. You can set the local scale of the box at runtime based on hSBarValue.

 transform.localScale = new Vector3(.1f, .1f, 1.0 * factor * hSBarValue);

If this is a permanent part of the game (rather than a debugging tool), replace the box with a 3D arrow object.

Comment
Add comment · Show 3 · 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
avatar image Alan Fletcher · Feb 23, 2013 at 01:17 AM 0
Share

this works for moving the pointer back and forth, but it starts moving my fps controller off the terrain in weird directions when i try to press a movement key Thanks for your help though

avatar image robertbu · Feb 23, 2013 at 02:06 AM 0
Share

I'm confused. There's nothing here that would move the fps controller. Did you add a rigidbody to the block?

avatar image Alan Fletcher · Feb 23, 2013 at 04:21 PM 0
Share

no what was happening was that the line was expanding in both negative and positive x values which was pushing the fps contoller, it worked perfectly when i moved it so it never actually touched the controller

thanks for your help

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

10 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

Related Questions

Mathf.pingpong 4 Answers

FPS Controller rotate between two points c# 2 Answers

turn on off particle system 1 Answer

Hide the ImageTraget in Real world 0 Answers

how to get in game numerical input 1 Answer


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