Sounds hard to make…:rolleyes:
Why don’t you try it out?
I would do it like this, but it is only my preference. Nothing critically important.
itemSelected = own['itemSelected'] # is a string itemCount = own[ itemSelected ] # notice no " " if left_click.positive: if itemCount > 0: NewPosition = hit_object.worldPosition + (hit_normal) new_block = scene.addObject( itemSelected ,own) # changed this new_block.worldPosition = NewPosition new_block.worldOrientation = (0,0,0) own[ itemSelected ] -= 1 # used a block
Yeah, but a bit different, because itemSelected is the item ID, but item count is amount of specific item. Maybe I should use itemCOunt1 for itemScelected with value 1 etc. That would make me able to make inventory, but I have problems with inventory anyway…
I’ve got question about inventory- how to make a limit of items per inventory, if items are stored with IDs item1, item2, item3 etc? Each ID id integer and contains value that shows how much of that item you have. I want to limit item count per inventory to 12(like 12 slots) and than make a GUI of inventory. Maybe you could make an example and tutorial for this too, as this sounds very complicated for me? The best way would be data storing in slots, so, in example, slot1=item3, slot2=empty, etc, where empty can be replaced with item. I don’t have any idea on how to make this. Please, help!
My latest question- how to make it non-voxel version now? I want player to be able to place evrything evrywhere!
Have you tried the example with different models?
What kind of bug did you get?
How would you solve it?
Also. It wasn’t voxels to begin with.
So, does that count :D?
Well, that code worked. Anyway, the code reads the normal of object and places block there- is it possible to place it on side of normal, not only on center?
Side of the normal?
Certainly, but why, i don’t get why.
You probably mean on any spot on the face or in other words the hit position.
NewPosition = hit_object.worldPosition + (hit_normal)
NewPosition = sensor.hitPosition + (hit_normal)
aVariable = 2 #or 0.5 for if you use unit cubes
NewPosition = sensor.hitPosition + (hit_normal) * aVariable
this variable varies per model if you don’t use cubes.
The initial problems are solved by either defining a vector on how far to place the object from the hit position or by setting the origin of the object one unit vector away from the connection face.
Then there is only the problem of allinging (rotating) to object according to the normal.
I will test! Yes, I meant on evry pointof face!