2 weeks ago
Hi all!
Can someone proved me with an example code of 2 hotspots that rotate horizontally and vertically
For example you have a box that you rotate 35 degrees horizontally and then rotate it 35 degrees vertically (hotspot follows rotation)
Thank you in advance!
2 weeks ago
The problem is you do not want to rotate the horizontal hotspot code (ROTz) horizontally but you do want to rotate it vertically.
And you don't want to rotate the vertical hotspot code (ROTx) vertically but you do want to rotate it horizontally.
And you actual object you want to rotate both.
So, just thinking out load without actually testing it myself, you would need to ...
ROTz !!rotate vertical hotspot horizontally only
code for vertical hotspot
DEL 1
ROTx !!rotate horizontal hotspot vertically only
code for horizontal hotspot
DEL 1
ROTz
ROTx
code for object
DEL 1
DEL 1
I think.
Barry.
2 weeks ago
Is the movement dependant or independant? And you are wanting to define them by angle given a set distance?
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2 weeks ago
Yes.
I want to define both rotation by variable, moving hotspot is at a fixed distance lets say at A,0 (End of box) and vertical hotspot is at A/2,0 (half length of box) but when I change the angle, moving hotspot needs to be at that location (see code) the problem is when I set vertical rotation my horizontal plane is wrong. I am imputing the wrong coordinates but I do not know anymore how to it 😅
material mat1
rotz verticalRot
roty horizontalRot
addy -0.5/2
hotspot 0,0,0
hotspot 0,0.5,0
hotspot 0,0,0.25
block 1,0.5,0.25
del top
unID=000
!=== HORIZONTAL ROTATION ===!
hotspot COS(verticalRot),SIN(verticalRot),0, unID, horizontalRot, 4: unID = unID + 1 !--- BASE
hotspot COS(verticalRot)*COS(horizontalRot)*0.5,SIN(verticalRot)*COS(horizontalRot)*0.5,-TAN(horizontalRot)*COS(horizontalRot)*0.5, unID, horizontalRot, 5: unID = unID + 1 !--- MOVEING
hotspot 0,0,0, unID, horizontalRot, 6: unID = unID + 1 !--- CENTAR
angleForRefence=verticalRot+90
hotspot COS(angleForRefence)*5,SIN(angleForRefence)*5,0, unID, horizontalRot,7: unID = unID + 1 !--- REFERENCE
!=== HORIZONTAL ROTATION ===!
!=== VERTICAL ROTATION ===!
hotspot 5,0,-TAN(horizontalRot)*COS(horizontalRot), unID, verticalRot, 4+128: unID = unID + 1 !--- BASE
hotspot COS(verticalRot)*COS(horizontalRot),SIN(verticalRot)*COS(horizontalRot),-TAN(horizontalRot)*COS(horizontalRot), unID, verticalRot, 5: unID = unID + 1 !--- MOVEING
hotspot 0,0,-TAN(horizontalRot), unID, verticalRot, 6: unID = unID + 1 !--- CENTAR
hotspot 0,0,5, unID, verticalRot, 7: unID = unID + 1
!=== VERTICAL ROTATION ===! !--- REFERENCE
2 weeks ago
This is better.
The two hotspots need different radii, other wise you will only be able to select one of them.
The inner one is horizontal and the outer one is vertical.
I cheated and rotated the horizontal hotspot script and just substituted the vertical parameter.
material mat1
roty verticalRot
rotz horizontalRot
hotspot 0,0,0
add -0.5, -0.25, -0.125
block 1,0.5,0.25
del 1
del 1
del 1
unID=000
roty verticalRot
!=== HORIZONTAL ROTATION ===!
hotspot 0,0,0, unID, horizontalRot, 6: unID = unID + 1 !--- CENTAR
hotspot 0.5,0,0, unID, horizontalRot, 4: unID = unID + 1 !--- BASE
hotspot COS(horizontalRot)*0.25,SIN(horizontalRot)*0.25,0, unID, horizontalRot, 5: unID = unID + 1 !--- MOVEING
hotspot 0,0,1, unID, horizontalRot,7: unID = unID + 1 !--- REFERENCE
!=== HORIZONTAL ROTATION ===!
del 1
rotz horizontalRot
rotx -90
!=== VERTICAL ROTATION ===!
hotspot 0,0,0, unID, verticalRot, 6: unID = unID + 1 !--- CENTAR
hotspot 0.5,0,0, unID, verticalRot, 4: unID = unID + 1 !--- BASE
hotspot COS(verticalRot)*0.30,SIN(verticalRot)*0.30,0, unID, verticalRot, 5: unID = unID + 1 !--- MOVEING
hotspot 0,0,1, unID, verticalRot,7: unID = unID + 1 !--- REFERENCE
!=== VERTICAL ROTATION ===!
del 1
del 1
Barry.
2 weeks ago - last edited 2 weeks ago
If stacking angle hotspots does not work, you could script intermediate x, y and z parameters that feed back into the angles. One advantage of this is that you can use the x and y coordinates in 2D to control both the pitch and yaw.
Barry, your vertical reference axis needs to shift for the given horizontal rotation else the hotspot vs object rotation axis do not match. Adjusting the base, reference and sometimes centre hotspot in relation to a different transformation is a pain...
Edit:
Transformation in the OPs code is indepentant.
Transformation in Barry's code is dependant.
If the issue here is that the gizmo is not lining up with the rotation when a pitch that isn't zero, this is caused by your centre hotspot not moving. The gizmo rotation is based on the plane formed by the centre, base and moving hotspot with the orientation being defined by the reference, hence with your static centre point, this plane rotates out of line with the actual rotation.
Ling.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2 weeks ago
The only working (with some drawbacks) solution would be to have movement hotspot (with constraints) and then calculate the angles from vector from say 0,0,0 to the hotspot. (ofc + some overrides/safety catches for trig functions have to be done...depending on the vector)
a week ago
The only drawback would be the added complication in the script? It is also by far the most user friendly, as then there is just a single hotspot that they move to point where they want.
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
a week ago
Basically yes, the angle to coords on glob_modpar_name and vice versa, but also for user point of view it might not look straight.
make a lin_ and hook it to the movement hotspots and see how it looks first - as from user point of view