Thanks if you have any suggestions.
If you can subclass the plants you can give them a collision, set the bCollidePlayers to true and write what happens when a player touches them in Touch(), for every player(using the TouchingActors) make them aim a bit away from each, find a middle point where to aim at. In UnTouch() you can do the check, if there are no players touching them then set the rotation to the initial one.JackGriffin wrote:I've been trying to figure out a way to cause plants to wiggle a bit as you pass (touch) them. I don't want to make animated plants, I'd like to use the stock meshes. Has anyone seen something like this? I know Rune had some but I want to keep my coop server maps the way the map maker intended, I just want the decoration classes to have more interaction. I added falling leaves to the tall trees and they can be burned down if you blast them. I'd like the short plants to move some if they are blasted or if you walk among them.
Thanks if you have any suggestions.
Also, I forgot that we cannot choose a pivot point in UT differently from Unreal, so the only way to rotate the plant from the bottom is to attach it to another actor which should be placed at the bottom of the plant and rotate that actor instead.JackGriffin wrote:This is actually a pretty good idea. I tried a version of this where I altered the rotation, yaw, pitch, etc a bit in tick (and then in timer) to see if I could get a decent enough effect. None of it looked good at all. It just appeared that the plant was doing things it shouldn't. This just may not be a possibility or I'd have seen something already in a past mod.
- Posts: 5138
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Things like trees bending at the detonation of a nuke for example, stuff like that (I even experimented a bit with it in the far past, when I was still the noobest of noobs at this stuff).
Either way, here's what I think: doing it as an animation is the best and most realistic way to go in this engine.
If you do that, an idea I personally had was to animate it from at least 9 different spots (9 animation sequences): as if the plant was being touched from each one of 8 sides (2 axis plus the diagonals), and one in the middle (where it gets more squashed).
From there, in theory, you could set an animation sequence on touch, and have the plant to transition to another seamlessly, all depending on your position relative to the plant, making the whole effect extremely accurate and good looking.
But in this approach, I am not 100% sure if you can actually do this: for many things I did in the past I had mesh overlays which would match the AnimSequence and AnimFrame of the original actor, and even if the actor was tweening between animation sequences instead of animating a specific sequence from start to finish (which a player actor does a lot for example), I imagine that tweaking the AnimSequence and AnimFrame alone are enough to somewhat make a tween animation between 2 different sequences, but I never really looked into it at all.
The other more simplistic approach, without any animation at all, it's a bit like PrinceOfFunky mentioned, but rotating the plants themselves, and do so every tick while they're being touched, since their rotation must be recalculated no matter how little you move so it matches what you expect to see in the end (a rotation where the plant kinda "looks away" from you), but it should only be a slight otherwise it will look very wrong.
In addition to this, you can perhaps try to toy with other properties, such as Fatness, by decreasing it to make the plant look slightly slimmer while it rotates, and even LODBias, by also decreasing it to make the plant morph and distort a little bit.
For plants which is mostly green leaves and nothing more, you can also try to spawn more of the same plant with different rotations, and then depending on where you are, only one of them would actually rotate while the other plants would stay the same.
A similar approach to this would be to modify those plants somehow to split them into different singular leaves, and then once placed in a map, you could spawn the leaves and do the same thing.
Just my 2 cents
You can: UT also has PrePivot, it's just not exposed in UEd unlike in Unreal, but it's there and exposed to UScript, so you can freely change it through defaultproperties or code.PrinceOfFunky wrote:Also, I forgot that we cannot choose a pivot point in UT differently from Unreal, so the only way to rotate the plant from the bottom is to attach it to another actor which should be placed at the bottom of the plant and rotate that actor instead.JackGriffin wrote:This is actually a pretty good idea. I tried a version of this where I altered the rotation, yaw, pitch, etc a bit in tick (and then in timer) to see if I could get a decent enough effect. None of it looked good at all. It just appeared that the plant was doing things it shouldn't. This just may not be a possibility or I'd have seen something already in a past mod.
But even if you didn't have it, you wouldn't need to do all that.
If you want to rotate an actor relative to an arbitrary 3D location, all you need to do is to define that location, let's say NewPivot, calculate the vector from it to the actor location ( V = A.Location - NewPivot ), rotate it ( V = V >> SomeRotation ), and in the end set the actor location to where the rotated vector is now pointing at ( A.SetLocation(NewPivot + V) ).
It would be a matter of applying a bit of math, and do what the engine itself would do anyway, but without the actor overhead.
- Posts: 6514
- Joined: Thu Jun 30, 2011 8:12 pm
- Personal rank: God of Fudge
- Location: Palo Alto, CA
I've been spending some time in Blender and I'm getting comfortable with the basics so it's not so intimidating to consider this path.