Page 1 of 1
lowering doors, and sinking alters?
Posted: Thu Oct 08, 2015 9:22 am
by LunasC
I am trying to get an alter to sink into the ground when triggered. I used some of the script for a door but I cannot for the life of me seem to make it go down into the floor.
Everything I have tried has led me to either a glitch or an alter rising to the ceiling.
Any help would be great as I am losing my mind here.
Re: lowering doors, and sinking alters?
Posted: Thu Oct 08, 2015 12:06 pm
by minmay
If you want it to function like a door then you need to edit the model so it has a gate node (look at the door models in the standard assets for examples). Non-double doors always open upwards, so you would need to start it opened instead of closed. Of course, you'll have to separate the model and door components into a different object if you want to do this, because trying to use a DoorComponent and a SurfaceComponent/ObstacleComponent on the same object is just not going to work. Note: this approach is a really bad idea.
A better approach is to call GameObject:setWorldPositionY() every frame. (To run code on every frame, just add a TimerComponent to the party object with a very small interval like 0.0001; TimerComponents only trigger a maximum of once per frame, so the result is that its onActivate hook will be called once every frame). You will need to move any items on the surface as well as the altar though.
You could also make an animation for it, but it's easier to just change the world position every frame. No matter what approach you use, you'll have to do something about the items on the altar.
Re: lowering doors, and sinking alters?
Posted: Thu Oct 08, 2015 9:18 pm
by Azel
LunasC wrote:I am trying to get an alter to sink into the ground when triggered. I used some of the script for a door but I cannot for the life of me seem to make it go down into the floor.
Everything I have tried has led me to either a glitch or an alter rising to the ceiling.
Any help would be great as I am losing my mind here.
Here ya go:
http://mystrock.com/files/AltarFun.zip
Lowers an Altar in to the dungeon floor (through a trap door). And then raises it back out. Hope it helps!
