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 nybrinton · Dec 24, 2020 at 11:35 AM · rotationtransform.rotatequaternion.lookrotation

Help with L System Rotations

Hello I am having trouble getting a Hilbert curve to appear using the following L System:

  1. X: "^ / X F ^ / X F X - F ^ / / X F X & F + / / X F X - F / X - /"

  2. Initial String: X

  3. Angle: 90

The way I am calculating the angles is as follows

 if (character == 'F')
             {
 
                 Vector3 old_pos = turtle.transform.position;
                 GameObject new_point = Instantiate(point);
 
                 turtle.transform.position += line_length * turtle.transform.up;
 
                 new_point.transform.rotation = turtle.transform.rotation;
                 Vector3 pos = turtle.transform.position;
                 pos[0] += line_length;
                 new_point.transform.position = pos;
                 new_point.transform.localScale = new Vector3(starting_width, line_length, starting_width);
                 //new_point.transform.parent = turtle.transform;
 
 
                 Debug.DrawLine(old_pos,turtle.transform.position, colors[i%7], 5000f);
 
             }
             else if (character == 'f')
             {
                 turtle.transform.position += line_length * turtle.transform.up;
             }
             else if (character == 'w')
             {
                 starting_width *= width_ratio;
             }
             //Pitch down(&) and up(^) by delta
             else if (character == '&')
             {
                 turtle.transform.Rotate(Vector3.right * delta);
             }
             else if (character == '^')
             {
                 turtle.transform.Rotate(Vector3.left * delta);
             }
             //roll right(/) and left(*) by delta
             else if (character == '/')
             {
                 turtle.transform.Rotate(Vector3.down * delta);
             }
             else if (character == '*')
             {
                 turtle.transform.Rotate(Vector3.up * delta);
             }

This system works with the following L System and produces the desired result

  1. alt textA: "[&FFFA] //// [&FFFA] //// [&FFFA]"

  2. Initial String: FFFA

  3. Angle: 90

However when attempting to make a Hilbert curve and other L Systems the results are not as expected alt text

What would be the correct way to go about coding these rotations in Unity described on page 3 in the following PDF: https://www.bioquest.org/products/files/13157_Real-time%203D%20Plant%20Structure%20Modeling%20by%20L-System.pdf

(I have tried writing out the rotation matrices but it didn't solve my problem. Let me know if any other information is required)

screenshot-1.png (97.4 kB)
screenshot-3.png (73.1 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Dec 25, 2020 at 03:47 PM

It seems that your used L system rule is faulty. It looks very similar to the one mentioned over here but you don't have the proper counter rotations at some places. To quote from the SO answer:

 lsystem Hilbert3D {
 
     set iterations = 3;
     set symbols axiom = X;
 
     interpret F as DrawForward(10);
     interpret + as Yaw(90);
     interpret - as Yaw(-90);
     interpret ^ as Pitch(90);
     interpret & as Pitch(-90);
     interpret > as Roll(90);
     interpret < as Roll(-90);
 
     rewrite X to ^ < X F ^ < X F X - F ^ > > X F X & F + > > X F X - F > X - >;
 
 }

If you compare it to your rule, you always use a "/" where in this rule there is either a < or >. So you're rotating in the wrong direction.

I haven't tried this 3d hilbert curve construction rule.

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

152 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Accelerating in Turned Direction 2 Answers

How to find or compute or look for overall/max RPM by simply checking for rotation? 1 Answer

Quaternion LookRotation issue 0 Answers

making an object below this object follow rotation on y axis 0 Answers

Making Player Rotation Smoother 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