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
-2
Question by caiodmk · Oct 29, 2011 at 06:28 PM · c#movewalls

Still trying to move walls

I'm working on a room inmy game which has some boxes(walls) that move back and forth blocking your way throgh the room. So what I have to do it place a box in between the 2 walls that are closing the way and jump over it while it holds the walls. In a diagram it looks like this:

Diagram(Click Here)

XX -> is a THE BOX I must place in between the walls 1 -> start position of the walls 3 -> is where it would go if there was no box blocking the way, the way would be closed 2 -> is where it should stop if the box is in the way

in theory that's how I would solve it:

void Update() { wall1 moveTo point3, wait, moveTo point1;

 if(wall1 hit box1)
 {
     wall1 moveTo point2, wait, moveTo point3;        
 }

}

or

void Update() { wall1 moveTo point3, wait, moveTo point1;

 if(wall1 hit box1 and DistanceTraveled < distFrom(point1 to point3))
 {
     wall1 moveTo point2, wait, moveTo point3;        
 }

}

not sure if I will need to calculate the distance traveled. I've been stuck on this for ages. Someone please save me :)

Comment
Add comment · Show 2
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 Bunny83 · Oct 29, 2011 at 10:51 PM 0
Share

Seriously... You waited 2 hours and post a duplicate question? Be patient and if you want to extend your question edit the old one but don't post the same question multiple times:

http://answers.unity3d.com/questions/181067/moving-walls.html

avatar image caiodmk · Oct 29, 2011 at 10:56 PM 0
Share

I tried to make it on a diferent way, that's why I posted 2 questions, to get diferent solutions. I still want to know what I asked on the other post, that's why I didn't edit it.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by chemicalvamp · Oct 31, 2011 at 07:04 AM

Animate the wall and use http://unity3d.com/support/documentation/ScriptReference/Animation.Play.html

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 caiodmk · Nov 01, 2011 at 02:11 AM 0
Share

1st thing I tried doing was animating it, but my $$anonymous$$cher said it wouldn't work properly with the boxes in the way. Do you think it would work? I'll give another try anyway. Thanks

avatar image chemicalvamp · Nov 01, 2011 at 02:26 AM 0
Share

That is not really enough information on "the boxes" for us.. are they moved by physics or are they animated as well.. if they are animated you could just do the ti$$anonymous$$g so they are out of the way for the walls. if the boxes are stationary I dont see how they would affect the animation of the walls as long as you anticipate it.

avatar image caiodmk · Nov 01, 2011 at 12:26 PM 0
Share

They are moved by physics, as soon as I get time I'll try it out and post how it went here

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

How to move particles from script ? 3 Answers

Multiple Cars not working 1 Answer

How to move an object in world with script 1 Answer

Errors with gravity switching... 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