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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Borka · Mar 19, 2012 at 03:52 PM · meshplaneanimate

Animate one side of a plane

How do I select only one side of a plane and only animate that?

I found a pice of code that does almost this, but it animates the whole plane instead of just one side. The goal is to get one side to kinda look like waterwaves. A sine wave would perhaps work?.

using UnityEngine; using System.Collections;

public class wave : MonoBehaviour {

private float scale = 3f;

private float speed = 1f;

private Vector3[] baseHeight; // Use this for initialization void Start () {

 }
 
 // Update is called once per frame
 void Update () {
  Mesh mesh = GetComponent<MeshFilter>().mesh;
 
 if (baseHeight == null)
     baseHeight = mesh.vertices;
 
 var vertices = new Vector3[baseHeight.Length];
 for (int i = 0; i < vertices.Length; i++)
 {
     Vector3 vertex = baseHeight[i];
     vertex.y += Mathf.Sin(Time.time * speed+ baseHeight[i].y) * scale;
     vertices[i] = vertex;
 }
 mesh.vertices = vertices;
 mesh.RecalculateNormals();
 }

}

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by DaveA · Mar 19, 2012 at 10:37 PM

What do you mean by 'side'? The 'front' vs 'back' or some edge? A Plane (the default Plane mesh in Unity that is) has a grid of triangles, that seems to be what you are adjusting here. There is just the mesh. Each 'side' of each triangle is part of that triangle.

If you need the other 'side' to be a flat plane, while the animating 'side' moves on top of that, add another plane and don't animate it. And probably flip it 180 degrees so it points the 'other' direction.

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
0

Answer by Borka · Mar 20, 2012 at 06:56 AM

I want to animate the top edge of the plane. Should I somehow select only the top edge triangles and add a sineanimation to them?. How would I do that?

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Simple mesh height alteration. 1 Answer

Is Mesh Collider possible on an animated plane ? 0 Answers

Material behaving weirdly! [Pics inside] 1 Answer

How can I create a mesh plane with more vertices? 1 Answer

How to assign UV coordinates to arbitrary mesh. 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