While playing around with trying to place voxels which follow the player i spend a while trying to figure out why the logic seemed correct but the resulting voxels were being drawn in the wrong place, After setting the position of the object running my voxel script to 0,0,0 all started to work as intended,
For example i was telling my voxel to start at 0,0,0, when my object was not at 0,0,0 and move towards the player at 25 units a every 3 frames,
Can i just ask is the pos taken by VoxelComponent:SetVoxel working in the local space of the entity you use to call it, and if so could we get the docs to note this is the case?
Also do we have a limit on how many voxels we can create at once, I found when i created 1 voxel every 3 frames they would appear when requested but when i tried to draw 1 voxel a frame, the system would appear to queue up the requests are process them all in a single frame at a later time,
I’ve been having a separate issue, but your question gives me hope that it can be done! I’m new to lua, and also Crayta (obviously).
Would you mind posting the lua code you are using to set voxels. I seem to be getting all sorts of errors. I think my main issue is that I don’t understand how to get hold of a VoxelAsset to pass to the SetVoxelBox method.
Ahh, thanks very much. I’ll try that out tomorrow.
In an effort to try to help you with your problem - the API docs says SetVoxel “Server Change a single voxel in world space.” - so the answer to your first question seems to be world space. There may also be a clue about the number of voxels you can change - it seems that voxels are edited on the server, then at some point the clients update somehow. Perhaps that might give you a clue towards what is going on.
It’s probably not much help - but hopefully it helps a little.
This is the code I am using the spawn a single voxel in the world since I feel the function is working in the local space of the object it’s connected too i’m converting the worldspace pos into local space,
A break down of what each value is: self.tbodyParts is Vector, this is where i want the voxel to be drawn, self.entityStartPos is a Vector, this is the position of the entity running the script