Thank you Pompidom, yes you have a very simple solution; and I appreciate the work you've done to help with my question.
The reason this doesn't work, is because of the DynamicObstacle component. Say I was to use this script, which does work in dropping the block which was the initial problem. (Adding a gravity component does the same thing.) The problem with this is since the DynamicObstacle remains in the initial position. Even if you add an invisible platform, or add a platform component to the block, the DynamicObstacle is still at height 1, and blocks passage. Meanwhile you can walk through the actual block model at height 0 as it now has no collision.
So yes, your script visually does the job. It mechanically fails at every point for what I need it to do. As no matter how you destroy, disable, enable, create and recreate; the instant you move the block via this script you're going to run into this problem. While yes, I could add in invisible walls at the 4 sides of the model when it's at height 0 via more scripting, and destroy/create blocks at whim to keep the components in the same 'real space' as the model, or disable the Dynamic Obstacle completely. That's not solving the actual problem that's working around it with admittedly clever solutions. It can also lead into other problems like if a player finds a creative solution that you didn't think about.
Edit
I've been doing some thinking and research on this and came up with a solution of sorts, just have a few questions on how to implement it. In the Pushable Block object script it has the clickable class and uses party facing to move the block in the cardinal directions. If I can add two more directions, on the Z axis using the mechanic it should be a matter of calling that with a button or timer, whatever to move it in those directions. The problem of course that the party can't 'face' up or down. While we can move the camera to view up or down, that's completely different than what the game understands. So I took a look at the code:
Code: Select all
{
class = "Clickable",
name = "clickWest",
offset = vec(-1.2, 1.15, 0),
size = vec(0.1, 1.2, 1.2),
maxDistance = 1,
--debugDraw = true,
onClick = function(self)
if party.facing == (self.go.facing+1) % 4 then
self.go.pushableblock:push(party.facing)
end
end,
},
This is what I am understanding this to do. When you click on the block, it looks at all 4 'clickables' and runs the function(self) on each. Which takes the facing of the party and see's if it's equal to it's facing, +1, +2, or +3 to get the four directions. Then for the one it finds true it moves the block by the offset vector value. So what I can in theory set a vector for the +- Y vector in two more to have it move up and down via the :push command. The only question is how do I script it not using a party.facing. I've been looking through the script reference but not seeing something to satisfy this. While I know I could just tell the script on click to go up or down the Y axis. Since the clicking mechanic doesn't account for the face that it's clicked on, that would ring true for every way clicked making it either crash or simply not do anything as both up and down would be always true every click. A lever activate/deactivate could solve this, if I hard code a rise fall lever and include it in the dungeon; would there be a better solution though?