Helo everyone,
I want to enable the snap to grid funcion via blueprint… I mean, not in the editor but in the executable itself.
any ideas on how to do that?
Thanks!!!
Helo everyone,
I want to enable the snap to grid funcion via blueprint… I mean, not in the editor but in the executable itself.
any ideas on how to do that?
Thanks!!!
I might not understand the question correctly as I don’t understand what oculus has to do with grid snapping. In any case it largely depends on what kind of grid you are using.
I will shoot in the dark here and say that the only thing you need to do is adjust the position of the object in order for it to snap to a grid.
NewPosition = Round( OriginalPosition / GridSize ) * GridSize (this is not actual code)
Okay, Im gonna try to explain a bit better.
I want to use the same system on the editor when you move a mesh, its pivot point snaps to a grid in the world, but I want to use it on a packed game that is gonna use the pickup blueprint for Oculus Rift…
So I need this pickup object to snap on a grid in the world when it spawns, its not going to be affected by phisics, but I need to be placed always on an invisible grid just like I do in the editor.
hope I made myself clearer this time.
Thanks.
there are two nodes that i know of that will do that for you or you could make a script that does the math, of course im basing this grid on world coordinates and not on a actual grid mesh. the first node is snap to grid float which is built into the engine. it function pretty much by rounding a float to the grid size, so given a grid size of 10, 6 would become 10, 3 would become 0, and 22 would become 20. the second node is grid snap which is part of the victory plugin by Rama. it takes in a vector and does the same thing as the last node but to each axis in this case.
Thats kind of going where I need to, but how do I connect “snap to grid” into the pickup bluprint…
Im think its on al location rule from the node “detach from actor”
So How to make a Location rule that make the pivot mesh snaps to a world gird?
Thanks
what do you mean?
if its for when it gets spawned in the world like your question asks then you would on begin play get actor location then use 3 snap to grid floats as seen below and a set location. its basically the same when you drop the item, if you want it to happen then too. as for movement when held well that depends on the implementation of your movement system and the character its attached to. you could do a on tick or timer set location as well.
Yes! its for movement when held, so I have to modify not a blueprint on the mesh but in the actual motion controller itself?
well no not exactly, you would need to create a way which updates and set the location of the item on a regular interval like on tick or at least thats the first method that comes to mind. it seems like it has the potential to be a far more complex prospect in reality though.
i would try to work something out and figure the method that way but i dont have a motion controller setup, hmmm maybe i can try it with the mouse or kinect or something. in any event how you would implement it is based on how the movement of the item is handled. i would think the get and set location method would work though.
okay so
I manage to solve the location alignment to a grid when I release the object thanks to this video, in the minute 18:30
I noticed that there is a location en rotaiton rule on the “detach from Actor” option, But I dont know how to set a rule for those, Thanks again if you can help me