October 14, 2019
Pulley System Generator
Fixing
Notes:
– Deselecting “Fix Start” and “Fix End” on the Rope component allows for the creation of a simple rope that appears to operate normally, but it is not connected to anything– “Fix Start” and “Fix End” appear necessary to connect the rope to physics objects
TESTING
Issue 1:
Instantiated Rope is a completely broken mess of physics masses jumping around.
Test 1:
Changing objects at ends to TestBox and TestSphere just to simplify the physics objects involved to see if that makes diagnosing the problems easier
Results:
This did result in a more stable rope. It was still not in the correct location, but the rope was no longer just a jumbled bumbling mess of masses.
Issue 2:
Rope is instantiated in a strange position away from most other objects.
– This appears to be because of the ropeStart and ropeEnd positions. The rope is still following their positions, and they are far away.– The ropeStart and ropeEnd positions however do have the same Y and Z values, suggesting that they are following the logic to some degree, but not as intended.
Test 1:
Change instantiation process so that pulley end objects are instantiated as children of the overall pulley prefab.
– The idea is that this will help with relative positioning– I am not sure if I can use this method with a prefab that has not been instantiated yet (seems strange using the transform of an object that does not exist yet)
Results:
– This did properly situate the rope end physics objects at the ends of the rope, however the rope was still spawning in a location that was unintended, below everything else.– The rope also does not appear to actually be bound by the end objects either.
Test 2:
Debug.Log all the positions to see if the positions occurring at run time are matching those in the script.
Results:
– The script dictates that the start physics object is positioned at (-9.5, 0, 0) – (1.0, 0, 0), so (-10.5, 0, 0) relative to its starting position, and the end physics object is the reversse (+9.5 and +1.0). This indicates that there should be 21 units between them. This did happen, but the values are very different looking.– The start instantiated at position: (-2.5. -14, 35.5)– The end instantiated at position: (18.5, -14, 35.5)– This indicates that the parent position they are referencing is: (8.0, -14, 35.5)– Both RopeStart and RopeEnd child objects’ positions matchup with the weird physics object positions as well, so it’s before them.
SOLVED:
Turns out the overall prefab had the exact transform position (8.0, -14, 35.5) so those values were getting passed into everything as the starting parent transform value
Issue 3:
Rope is not actually connected to the physics objects at the ends.
– This is accomplished by setting the connectedBody reference of the RopeStart and RopeEnd objects to the rigid body components of the start physics object and end phsyics object respectively.– This is happening as seen in the references at run time, which makes me expect that this connection is still somehow ‘ being made before the instantiation of the full pulley setup.
Test 1:
Run everything in Awake instead of Start
– I thought running everything sooner may help set the connection up earlier.
Results:
– There were no noticeable differences.
NEXT STEPS
Figure out how to actually connect the objects to the ends of the rope.