We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2018-01-04 12:47 PM
unID = 1 ! -------------------------------------------------------------------------------- ! Center ! -------------------------------------------------------------------------------- hotspot 0, 0, 0, unID, ang, 6 : unID = unID + 1 ! -------------------------------------------------------------------------------- ! Base ! -------------------------------------------------------------------------------- hotspot 0.2, 0, 0, unID, ang, 4 : unID = unID + 1 ! -------------------------------------------------------------------------------- ! Moving ! -------------------------------------------------------------------------------- hotspot 0.2 * COS(ang), r * SIN(ang), 0, unID, ang, 5 : unID = unID + 1 ! -------------------------------------------------------------------------------- ! Reference ! -------------------------------------------------------------------------------- hotspot 0, 0, 0, unID, ang, 7 : unID = unID + 1
2018-01-04 04:16 PM
2018-01-04 04:47 PM
Bruce wrote:Ahh, it works but not how I want it. I want it to rotate around the Y axis. I've managed to get it to rotate that way, however the hotspot doesn't stay in the correct place. Here is my code now
First thing: The reference hotspot cannot be the same as the centre hotspot. An imaginary vector drawn from the centre hotspot to the reference hotspot forms your rotation axis...like the axel/hub of a wheel.
To rotate in the vertical plane, the z-axis coord of the moving hotspot needs to be used, and either the x or y coord left at 0.
E.g. to rotate around the x axis, using your parameters, would be:
ROTX ang
HOTSPOT 0, r, 0, unID, ang, 4 : unID=unID+1 ! Base
HOTSPOT 0, r*COS(ang), r*SIN(ang), unID, ang, 5 : unID=unID+1 ! Moving
HOTSPOT 0, 0, 0, unID, ang, 6 : unID=unID+1 ! Centre
HOTSPOT 1, 0, 0, unID, ang, 7 : unID=unID+1 ! Reference
DEL 1
I can’t test this right now, but it should be something like this.
unID = 1 HOTSPOT 0.2, 0, 0, unID, ang, 4 : unID=unID+1 ! Base HOTSPOT 0.2*COS(ang), 0, 0.2*SIN(ang), unID, ang, 5 : unID=unID+1 ! Moving HOTSPOT 0, 0, 0, unID, ang, 6 : unID=unID+1 ! Centre HOTSPOT 0, 2, 0, unID, ang, 7 : unID=unID+1 ! ReferenceIt rotates around the Y axis but the hotspot doesn't stay in the correct place :S
2018-01-05 01:59 AM
unID=unID+1 : HOTSPOT 0.2, 0, 0, unID, ang, 4 + 128 !Base unID=unID+1 : HOTSPOT 0.2*COS(ang), 0, -0.2*SIN(ang), unID, ang, 5 !Moving unID=unID+1 : HOTSPOT 0, 0, 0, unID, ang, 6 !Centre unID=unID+1 : HOTSPOT 0, 1, 0, unID, ang, 7 !Reference ROTY ang BLOCK 1, 1, 1 DEL 1
2018-01-05 10:58 AM
Bruce wrote:Thanks very much! Out of curiosity, why does the Z coord for the hotspot need to be negative? Very much appreciated!
4. The Z coord for the hotspot needs to be negative in this case.
2018-01-05 11:06 AM