- Home /
programmatically added SliderJoint2D not respected
How can I make sprites fall straight down, and resist any sideways motion whether by dragging or physics?
My code instantiates a prefab at runtime which has an attached script.
The script runs the following function after a while:
void addSliderJoint() {
myVerticalSlider = gameObject.AddComponent<SliderJoint2D> () as SliderJoint2D;
myVerticalSlider.angle = 90;
}
After this functions runs, I'd like the sprites to only move vertically, but they seem happy to move without restriction. I can "see" the SliderJoint2D in the inspector during runtime, and if I change its settings in the GUI, the sprites suddenly respond to it.
Sample repo available at https://github.com/thunderrabbit/finna-be-octo-wallhack
Your answer
Follow this Question
Related Questions
Distance Joint 2D not working as described? 4 Answers
Unity 4.5.2p2 SliderJoint2D broken or different? 1 Answer
2D Grappling Hook problems 0 Answers
keeping constant "Distance Joint 2d" 2 Answers