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 fjalla · Oct 26, 2012 at 03:21 PM · spawnmovecollide

How to move a object from A to B when the character collides with a object?

Hi. I have a spawn point where my player spawns. But I also have checkpoints, and I want that when the player collides with a checkpoint to move the checkpoint to a certain x,y,z position. I've tried to do it several times but without success. Anyone can help?

Comment
Add comment · Show 3
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 electricsauce · Oct 26, 2012 at 04:02 PM 0
Share

itween might help.

OnCollisionEnter() { transform.itween(pointA, pointB); }

avatar image fjalla · Oct 27, 2012 at 04:53 PM 0
Share

tried it, but it didn't work (because the script or because of me) :(

avatar image electricsauce · Oct 27, 2012 at 04:56 PM 0
Share

Post the script so that we have a better idea of what you're trying to do.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by hvilela · Oct 26, 2012 at 11:19 PM

Do you mean a teleporter?

Comment
Add comment · Show 2 · 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 fjalla · Oct 27, 2012 at 04:52 PM 0
Share

Yes, but I don't know how to do it so that the SpawnPoint moves, not the character.

avatar image hvilela · Oct 27, 2012 at 04:53 PM 0
Share

It's the same, just pass the spawn point game object ins$$anonymous$$d the character.

avatar image
0

Answer by Piflik · Oct 27, 2012 at 05:24 PM

Add this to your checkpoint:

 function OnTriggerEnter(item : Collider) {
     if(item.tag == "Player")
         transform.position = Vector3(x, y, z);
 }

This will move the checkpoint to whatever xyz coordinates you use, when an object with the tag 'Player' enters the checkpoint's trigger.

If you want to move the checkpoint multiple times to different locations, use a public array and put empty gameobjects from the scene there via the Inspector. Instead of using a specific Vector for the new position, you use 'array[i].transform.position' and increment 'i' afterwards.

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

11 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

Related Questions

Updating prefab information live 2 Answers

error on moving object to end of spawned object 0 Answers

Object moves to new location in vector array 1 Answer

Born again object 1 Answer

How can I create New GameObject (Instantiate) 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