Object Orientation Tutorial by DankerPie3

Have something important that other people might find usefull? Well, drop it here and help others!
User avatar
Level 3
Level 3
Posts: 184

Object Orientation Tutorial by DankerPie3

Post#1 » Mon Aug 15, 2016 7:43 am

moved over from projectspark.com forums

Orientation of objects, as exemplified by creation:

An object can be created at a designated position (see related creation FAQ thread), e.g.:
W: once D: create/object/at position/in world picked object (or vector position)

Basic orientation of a creation towards somewhere:

W: once D: create/object/toward/object 2
(needs a reference object, ‘object 2’)
Note: using the ‘toward’ tile the created object will angle in any direction, including up or down, to point toward the second object that must exist.
Note 2: If a template object is indicated with the in world picker as ‘object 2’, it will point toward the template!

W: once D: ‘new object’ object variable/=/create/object
---W: D: ‘new object’/forward/=/up (or world up)
Note: that up relates to the creator whereas world up is a fixed world vector.

or more complex variants in the child line:

---W: D: ‘new object’/forward/=/up/+/left
This will create a diagonal oriented object based on the creators orientation.

---W: D: ‘new object’/forward/=/world up/+/east
This will create a diagonal oriented object based on world references independent of the creators orientation, ie. all objects will point in the same direction.

An angle can be crudely adjusted if sufficient, e.g.:
---W: D: ‘new object’/forward/=/world up/+/(/east/multiplied by/3/)

Creating an object will fully flexible orientation by setting the position of its forward vector:

The default value of a vector component is 0 (and of a vector zero: 0, 0, 0) and when looking for its forward it is relative to its current position. So if you wanted an object to orient facing down:
W: once D: ‘forward’ vector variable/y component/=/negative/1
W: once D: ‘new object’ object variable/=/create/object
---W: D: ‘new object’/forward/=/’forward’ vector variable

To create a precisely oriented object use all 3 vector components to identify a position relative to the object that will serve as its forward:

W: once D: ‘forward’ vector variable/y component/=/negative/1
--- W: D: ‘forward’ vector variable/x component/=/0.5
--- W: D: ‘forward’ vector variable/z component/=/0.2
W: once D: ‘new object’ object variable/=/create/object
---W: D: ‘new object’/forward/=/'forward’ vector variable
This creates an object mostly pointing down, but at a discrete angle.

So you want to put an object in your world in a specific orientation?

1. The easy way:
Position your object exactly as you want it oriented and whilst in multi-edit mode select it and save it as an assembly. This changes it’s forward orientation so when created it will be in the orientation specified every time.

2. The harder way: Maybe you have many creates of the same object, but don’t want to save them all as separate assemblies to have them point in the direction you want:
Enter temporarily into the Kode of your object: W: D: display/forward. Then position it where you want. In test mode note the displayed world relative x, y and z components that give you your custom forward vector variable (see above) for that creation.
End of line.

Return to “Tutorials and guides”

Who is online

Users browsing this forum: No registered users and 2 guests