Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Ezel · Sep 07, 2011 at 01:57 PM · mesh3.4extrusionextrudestrict

Unity 3.4 and mesh extrusion script

Hi

Since I installed 3.4 I've been rewritting my scripts. As you know, even the Unity default scripts dont work because the new stricter compiler.

My problem is that for one variable (I think so) I can't compile my game. I use the script and the plugins of the mesh extrusion example of Unity, and there is a script called ExtrudedMeshTrail.js or something similar. In this script, there is one variable that I can't define

private var sections = new Array();

Then I get something like "time is not member of "object"" and point too

How can I solve this?

Thanks

 var time : float = 2.0;
 var autoCalculateOrientation = true;
 var minDistance = 0.1;
 var invertFaces = false;
 private var srcMesh : Mesh;
 private var precomputedEdges : MeshExtrusion.Edge[];
 private var sections : Array = new Array();
 class ExtrudedTrailSection
  {
 var point : Vector3;
 var matrix : Matrix4x4;
 var time : float;
  }

 function Start ()
 {
 srcMesh = (gameObject.GetComponent(MeshFilter) as MeshFilter).sharedMesh;
 precomputedEdges = MeshExtrusion.BuildManifoldEdges(srcMesh);
 }
 function Update () {
 var position : Vector3 = transform.position;
 var now : float = Time.time;
 while (sections.length > 0 && now > sections[sections.length - 1].time + time) {
     sections.Pop();
 }


 if (sections.length == 0 || (sections[0].point - position).sqrMagnitude > minDistance * minDistance)
 {
     var section = ExtrudedTrailSection ();
     section.point = position;
     section.matrix = transform.localToWorldMatrix;
     section.time = now;
     sections.Unshift(section);
 }
 

 if (sections.length < 2)
     return;

 var worldToLocal = transform.worldToLocalMatrix;
 var finalSections = new Matrix4x4[sections.length];
 var previousRotation : Quaternion;
 
 for (var i=0;i<sections.length;i++)
 {
     if (autoCalculateOrientation)
     {
         if (i == 0)
         {
             var direction = sections[0].point - sections[1].point;
             var rotation = Quaternion.LookRotation(direction, Vector3.up);
             previousRotation = rotation;
             finalSections[i] = worldToLocal * Matrix4x4.TRS(position, rotation, Vector3.one);    
         }

         else if (i != sections.length - 1)
         {    
             direction = sections[i].point - sections[i+1].point;
             rotation = Quaternion.LookRotation(direction, Vector3.up);
  if (Quaternion.Angle (previousRotation, rotation) > 20)
                 rotation = Quaternion.Slerp(previousRotation, rotation, 0.5);
                 
             previousRotation = rotation;
             finalSections[i] = worldToLocal * Matrix4x4.TRS(sections[i].point, rotation, Vector3.one);
         }
         else
         {
             finalSections[i] = finalSections[i-1];
         }
     }
     else
     {
         if (i == 0)
         {
             finalSections[i] = Matrix4x4.identity;
         }
         else
         {
             finalSections[i] = worldToLocal * sections[i].matrix;
         }
     }
 }
 // Rebuild the extrusion mesh    
 MeshExtrusion.ExtrudeMesh (srcMesh, (gameObject.GetComponent(MeshFilter) as MeshFilter).mesh, finalSections, precomputedEdges, invertFaces);
   }

  @script RequireComponent (MeshFilter)
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 DaveA · Sep 07, 2011 at 05:46 PM 0
Share

You'll need to post more code, this isn't enough to tell. Please include line number and indicate that line if you can.

avatar image Ezel · Sep 08, 2011 at 07:38 AM 0
Share

There is. About the line there are too many, the var is at 7 line and is used for example at 23 more or less.

avatar image rolodt40 · Apr 05, 2015 at 01:35 PM 0
Share

Hi, were you able to fix this? I'm getting the same error when trying to import the Procedural project (gotten from the assets store) into an existing project. But if I import the Procedural into an empty project everything works fine.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by msknapp · Sep 07, 2011 at 06:13 PM

Have you tried using the fully qualified name of the Array class? Remember that the .net framework includes an "Array" class but it does not have a "time" field. Try using "UnityEngine.Array();"

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 Ezel · Sep 08, 2011 at 07:40 AM 0
Share

Tried, seems that is not working, the same error. It is an array, but I don't know what contain that array so I can define the var as an array of this kind of "object".

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

how to Stack + Deform mesh along a path? 1 Answer

Extrude building mesh like Showdrop 1 Answer

Generate and extrude a mesh 2 Answers

Generating mesh - performance issues? 5 Answers

Getting errors with extrusion script. 0 Answers


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