I hadn't looked through script for addams family before but that one is documented nice for models. I could just about grasp how to get something going but came into a small problem which I cannot fix for now ![]()
Obviously if it wasn't a toy in FP you would use a drop target. This is how I can remember doing a ramp starter for example, just a simple hinge. Put the model in and switch on & off (up,down).
Can see the problem here. The ramp (drop target) starts off in correct position but something in the code moving it up? Angle.. Can some of this be removed just to allow the model into the table and be switched and not moved? Surely me using a drop target here is a bohemian way of doing it now.
public class drac_l1_StartRamp : MonoBehaviour
{
Animation anim;
float animSpeedSaved = 0f;
void Start()
{
try{
anim = gameObject.transform.FindChild("RampStart_animated").animation;
animSpeedSaved = anim["anim"].speed *6f / Time.timeScale;
BxTableManager.s_TableManager.AddSolenoidCallBack(8,RampCB);
}catch{ Debug.LogError("Error while setting Starter Ramp.");}
}
float angle=0f; // current animation angle
bool state = false;
void Update()
{
if(!state)
{}//angle = 0f;
else
{
angle += animSpeedSaved * Time.deltaTime * 30f;
angle = angle<0f ? 0f : angle;
angle = angle>30f ? 30f : angle;
}
}
void RampCB(int slot, bool b)
{
state = b;
anim["anim"].speed = b ? animSpeedSaved : -animSpeedSaved;
anim.Play("anim");
}
}




Top











are all trademarks of VPFORUMS.