GalaxySugar Posted May 23, 2024 Share Posted May 23, 2024 I've been experimenting with swimming characters recently to see how they managed to let the player jump in and out of the ocean, "Wirra the Wild Child" in particular. I've found that boats are a completely unusable when a player character is given the AmphibiousCreature component, constantly jump whenever they try to move. But other entities like hounds and grass gators don't have this issue. I think this is because the Locomotor component's OnUpdate function repeatedly pushes the "OnHop" event. Snippet from Locomotor: if not blocked then if can_hop then self.last_platform_visited = my_platform self:StartHopping(hop_x, hop_z, target_platform) elseif self.inst.components.amphibiouscreature ~= nil and other_platform == nil and not self.inst.sg:HasStateTag("jumping") then local dist = self.inst:GetPhysicsRadius(0) + 2.5 local _x, _z = forward_x * dist + mypos_x, forward_z * dist + mypos_z if my_platform ~= nil then local _ can_hop, _, _, _, blocked = self:ScanForPlatform(nil, _x, _z, hop_distance) end if not can_hop and self.inst.components.amphibiouscreature:ShouldTransition(_x, _z) then -- If my_platform ~= nil, we already ran the "is blocked" test as part of ScanForPlatform. -- Otherwise, run one now. if (my_platform ~= nil and not blocked) or not self:TestForBlocked(mypos_x, mypos_z, forward_x, forward_z, self.inst:GetPhysicsRadius(0), dist * 1.41421) then -- ~sqrt(2); _x,_z are a dist right triangle so sqrt(dist^2 + dist^2) self.inst:PushEvent("onhop", {x = _x, z = _z}) end end end end Is there any way to stop the constant jumping for AmphibiousCreature players? Link to comment https://forums.kleientertainment.com/forums/topic/156311-locomotor-and-amphibiouscreature-odd-behaviour/ Share on other sites More sharing options...
FurryEskimo Posted July 1, 2024 Share Posted July 1, 2024 Hello. ^-^ I know the constant jumping into the water can become frustrating, which is why Wirra can toggle the ability on/off using R. We considered auto-disabling the ability while standing on boats, but decides against it. Does that help? Link to comment https://forums.kleientertainment.com/forums/topic/156311-locomotor-and-amphibiouscreature-odd-behaviour/#findComment-1731167 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now