Hi there, I have making a River that follows a spline But I need my player to swim In it, But Placing box collisions manually In the editor Is super tedious and especially for a large map, So I figured if I somehow attached a box collision onto my spline I could use overlap event from there but I can only put static meshes on the spline, Any help with this would be extremely helpful, thank you.
You can use a Spline Mesh Component, it will deform and follow the curvature of the spline. You get to control trasforms at every point manually, too.
Yes I am currently doing that, but whenever I try to scale it up my Collision box just deforms, Im not sure if this would be too big a deal for swimming.
This does not look right. Ensure the mesh you’re deforming has complex enough geometry. A plain box will not give you great result.
If in doubt, post scritp.
Ok I made a More high quality box and it fixed It but now there is another problem, I cant scale it, Right now the river is really small but if I try to scale it starts artificing and looking odd And i think its because of the Geometry getting stretched, What would be a fix?
Post script, no one can guess what’s up. But, the standard approach would be:
- run
Construction Script
- iterate over spline points
- add Spline Mesh Components - you do not need overly complex meshes, consider performance. A low-poly cylinder with 4-5 rings should be fine. Or a box with a some subdivision.
- apply spline location and tangents to the SMCs
- set
Start Scale
andEnd Scale
of the SMCs - at no point should you be scaling the actual mesh yourself. No clue how the rest of your script looks like, but this part could be close to:
- adjust each
Spline Component
point’s scale in viewport - when it comes to handling collision, I’d start with this:
ObjectType
should be a custom River
type.
yes sorry, I was setting only x, y scale Not Z that explains why it was deforming weirdly And the lack of geometry on my cube was another reason. Thank you for all the help I greatly appreciated it!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.