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.
lowering doors, and sinking alters?
Re: lowering doors, and sinking alters?
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.
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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: lowering doors, and sinking alters?
Here ya go: http://mystrock.com/files/AltarFun.zipLunasC 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.
Lowers an Altar in to the dungeon floor (through a trap door). And then raises it back out. Hope it helps!