• 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
1
Question by Flash-Unity3D · Mar 25, 2010 at 10:14 AM · cameraguipersonfirst

How can i make change the First Person position by clicking a Buttom?

How can i make change the First Person position by clicking a Buttom?

In other words, With Which Script command can I change my First Person or Camera View position, With a click on a button? Well to Fly from position A to position B

Thank you

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

3 Replies

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

Answer by KvanteTore · Mar 25, 2010 at 11:04 AM

Take a look at this question. It might be related to what you want. Which object you want to change the position of depends on the way you have set up your object hierarchy.

To get whether a button (spacebar) is pressed, you can use Input.GetKeyDown(KeyCode.Space)

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
avatar image
1
Best Answer

Answer by mcadieux · Mar 25, 2010 at 01:15 PM

Check out http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html for a guide on UnityGUI if you haven't seen it yet. I would do something like:

function OnGUI () 
{
     if (GUI.Button (Rect (10,10,150,100), "MOVE")) 
     {
          Move();
     }
}

This will draw the button and call the function Move() when it is clicked. Now in your Move function you place the code to move the object.

Comment
Add comment · Show 1 · 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 Flash-Unity3D · Mar 25, 2010 at 02:44 PM 0
Share

Waht come in $$anonymous$$ove()?

avatar image
0

Answer by Chapter9 · Apr 30, 2010 at 04:28 PM

Check this out, it might help

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Rotate charcter with camera? 1 Answer

How do i remove the gui windows in my scene 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How can i control the Camera like This? 1 Answer

A GUI that appears in one camera view 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges