Download

Moving object tilt ?

When I played Simcity 2013 one of the effects I like is when moving a building the object leans / tilts toward where the mouse is moved (as if a box were dragged by holding 1 top corner), when it snaps just eases into it’s straight position. Any idea how to do this ?

If that doesn’t make sense I’ll try to find a vid.

Edit: It’s not so clear but can make it out in this vid … https://youtu.be/KoBYfQjFwX0?t=3m49s

Create a cube with 8 vertices and add it to an actor blueprint. Color the upper vertices red and the lowers ones black.

Create a parameter collection (red circle in the picture)
Now create a material for your cube, I took the wireframe material from the engine content.
Make an instance and apply it to the cube in the actor blueprint.

Here’s the material graph(right click and “open in new tab” to display in full size):

Now change the actor blueprint accordingly:

Of course, the “hello” print was just a test. And I still don’t know what takes more performance. Checking if the vector length isn’t zero, or setting the value for the parameter collection. So maybe, the branch takes more performance, than it gets. I probably should have saved the vector length in another var and then feed the branch with an “equal float to zero”-check.

Now hit simulate and drag your actor blueprint at the X or Y axis.
Let me know, if you it didn’t work for you. It works pretty good for me.

edit: The “lagBehindVector” variable on the right is a “Linear Color” type. Your can split the blue input by right click it and “split struct pin”

Thanks for the response. I don’t deal with materials much so I’m unsure applying the vertex color to a material and not having the object in the scene initially. I will try this tomorrow and hope it works out ok. :slight_smile:

You can google up how to vertex paint a cube or rect in blender for example, to bake the color into the mesh before import. It’s an easy process, once you found the tool in the gui.

edit: I recommend painting a cube in unreal engine first (make sure the paint tool has “color view mode = rgb channels” or similar).
Then you make the skew for for this cube. If you now paint a another mesh in an external software and replace the cube in the engine and it doesn’t work, you know for sure, you didn’t apply the vertex colors correct and don’t have to seek somewhere else for the error.

I’m still not entirely sure how this works but I tried increasing and decreasing the VInterp value hoping I could see more effect but with no change. I have many problems with my gfx card and applying this is making it cause some artifacts / speed issues and seems to not make up it’s mind where exactly the location is. However I do like the effect.

To increase the effect, change skewX and skewY in the material instance to 3 or 4 for example.
Here is what it looks like at 2:

https://www.youtube.com/watch?v=lmbCw7K6JlY

Looks nice, unfortunately what I have managed to do isn’t doing the same and looks very buggy. :frowning:

Well, I don’t know what you did wrong. No project, screenshot or video :confused:

I set up my movement to snap to grid but thought i’d temporarily remove it and focus on normal movement, it didn’t make any difference and I’m sure it’s a hardware issue. But ! I’ve noticed another problem, when moving around there is a lag between mouse and actor location point which is supposedly a tick problem however there also seems to be an ease in / out control. I’ve uploaded a vid …

But how can I now see, what you did wrong? I need to see your setup.
It could be the parameter collection, which is wrong setup in the material editor, or something is missing in the blueprint.
Or you didn’t color the cube in a correct way. Maybe you upload the project somewhere. Shouldn’t be that big in a .rar file.

Sorry to confuse you, the last post was without what you’ve suggested it something I noticed after starting again. I didn’t use the wireframe mat just started a blank one but I’m very sure I’ve done everything exactly as you’ve posted …

(I use Matinee to screen record but it doesn’t show the mouse)

Hm, I’m afraid I can’t help you more without a test project or screenshots of your setup. Because I don’t think it’s a hardware issue :confused:
Mesh, material and blueprint need to be checked. I’m pretty sure there is one thing you might have overlooked.

Probably, can I upload a project ?

Do you ask, if it’s possible in general? Because I already suggested you doing this. There is dropbox, googledrive, just to name two.

Yes just asking if it’s possible, not sure what I need to upload maybe just zip the whole project folder ? Running 4.18.3 on Mac. I’ll do it on GoogleDrive.

I looked into the project. And you didn’t paint the cube correctly. It works good, once this is done.
I also had to disable “set actor location” in your controller_BP. You can’t move a cube, which location you set to another object every frame.
Again, the skewX and skewY in the material is the skewPower. The VInterp Speed is the speed, in which the object will get back to its unskewed form.

Thanks again for taking the time on this, sorry it was the only way I could keep the vector paint data. Followed a tut … placed the cube mesh itself into the level go to paint it then apply the paint. Before that I tried putting the actor with the static mesh into the level and paint that but couldn’t keep the data. How should I apply it ?

I don’t know what you mean by keeping vector paint data. But setting the location of the cube to the floor has nothing to do with the vertex colors or the linear color variable.
All you need is to vertex paint a cube with 8 vertices(okay, 24 vertices, but I don’t count the vertices on the same place) in an external software. Learn how to use blender or something else you have access to. Your material and blueprint is setup correct, beside the function in the controller_BP, which prevents the cube from moving. If you paint inside unreal engine, the vertex colors are only visible in paint mode and only if you checked rgb channels while painting.

You really need to experiment with vertex colors in a more basic test first, before making more complex stuff out of it. As long as you don’t understand “why” it works, you just can copy and paste the effect, but not making even more interesting stuff out of it. Try to color a cube like shown in my first post. Then try to move this colored vertices using world position offset, just by feeding a vector x,y,z in the material. If that works, then put the cube in the skew demo and try to understand how everything works.

I tried adding vertex paint in Blender and seems to work fine now. The problem with with the controller_bp is not preventing it from moving, I always give the floor a collision object type of “floor”. I like the effect but have chosen something a little simpler, as it’s grid snapping when snapped to new location added a small anim …

The blueprint logic I was refering to was the following:

actorSetLocation.png

Congrats you made it working. Remember which values you can tweak to to optimize the behavior.