Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 10:41 PM |
| I'm controlling the animations for a golem through a script, and it will work for a while and then just randomly decide that it wants to stop working. It is setting the desiredangles correctly, but the joints don't move to that. However, they do work if I set the desired angle manually. Any suggestions? |
|
|
| Report Abuse |
|
|
| |
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
| |
|
|
| 14 Jun 2014 10:48 PM |
Things getting out of sync?
Make the script wait until the CurrentAngle is where it should be before going to the next angle. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 10:50 PM |
Why would I need that?
It waits 3 seconds and the MaxVelocity is .03. It works fine before anyways. I just don't know why it randomly stops |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2014 10:52 PM |
| Would randomly stop because it gets out of sync with how you need it? Idk, programming is weir sometimes. If all else fails, give it a try. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 10:53 PM |
| I guess, but I figured out that at a point, it starts changing the DesiredAngle property of the Motor6D, yet the function telling the joint to change the current angle to that stops working. I think it's a problem with Roblox. |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2014 10:55 PM |
Why would you directly modify CurrentAngle? I thought that was read-only.
Maybe set the velocity to 100+, do desired, the fix the velocity? |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 10:59 PM |
I'm not modifying the current angle, but neither is changing the DesiredAngle.
Changing the DesiredAngle normally causes the CurrentAngle to gradually approach it, correct? If you keep changing the DesiredAngle through a while loop, the internal scripting that makes that happen stops working unless you change it manually. It's annoying. |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2014 11:01 PM |
| Mind if you post how you are changing the angle? It sounds like you're simply using an insecure method. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 11:03 PM |
local Torso = script.Parent.Torso local LS = Torso.LeftShoulder local RS = Torso.RightShoulder local LH = Torso.LeftHip local RH = Torso.RightHip local N = Torso.Neck
local Hum = script.Parent.Humanoid
local Running = false
local LastPos = Torso.Position
function Walk() LS:SetDesiredAngle(.3) RS:SetDesiredAngle(-.3) LH:SetDesiredAngle(-.3) RH:SetDesiredAngle(.3) wait(.5) LS:SetDesiredAngle(-.3) RS:SetDesiredAngle(.3) LH:SetDesiredAngle(.3) RH:SetDesiredAngle(-.3) wait(.5) end
function ResetLimbs() LS:SetDesiredAngle(0) RS:SetDesiredAngle(0) LH:SetDesiredAngle(0) RH:SetDesiredAngle(0) end
--coroutine.wrap(function() while wait() do print("LOOP WORKING") if (LastPos-Torso.Position).magnitude > .2 then Walk() else ResetLimbs() end LastPos = Torso.Position end --end)() |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 11:03 PM |
| I'm not using the Running event because it didn't work for some reason. But the loop still fires even when it stops working... |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2014 11:08 PM |
Again, you are waiting .5 assuming the limbs will reach the position (Even minor lag might cause them to be off a bit). When things get out of sync, anything can happen.
Also, I think you should look at the animate script that come with players by default. That got walking accomplished. You should be able to cut and modify the code to your needs. I would, but my studio is down, and I'm headed to bed. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 11:10 PM |
| The new animation script runs off of completely animation instances, which I'm not using here. The old one, maybe, but Roblox scripting is super messy. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 14 Jun 2014 11:15 PM |
| Tried making it wait for the current angle, and it didn't move at all. I even tried making it wait until it was close to the desiredangle, but it still didn't work. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 15 Jun 2014 08:36 AM |
| Anyone with input this morning? |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2014 08:55 AM |
| It must be something to do with your script. I'm currently using a motor6d rig I made for an advanced character, and my animation scripts are working fine. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 15 Jun 2014 09:03 AM |
| Are you using local scripts? They work fine when I do that, but these aren't in a character, they're in an NPC. I posted the script above if you need to look. |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2014 09:18 AM |
| Yep, I'm using a local script for the player, although for the dummy in my game I'm using a regular script, and it doesn't seem to be messing up. My regular script for the dummy is pretty similar to yours, and I don't see why yours would be stopping suddenly either. Is it a possibility that you might have too many scripts running or have too many bricks in your game for the server/client to be able to handle the motor6ds running? |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2014 09:22 AM |
--coroutine.wrap(function() while wait() do print("LOOP WORKING") if (LastPos-Torso.Position).magnitude > .2 then Walk() else ResetLimbs() end LastPos = Torso.Position end --end)()
Wait, I went to your game to see if I might be able to find something, and I saw what you meant when it stopped working. Maybe it has to do with your magnitude? You said if the magnitude is > .2 then Walk() else ResetLimbs(). So that means that the magnitude must not be going over .2 after a few seconds causing ResetLimbs() to run. |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2014 09:25 AM |
| Yep, just tested that theory on your game. Whenever I come near it, the animations stop, and when I walk away, they start again. Remove the magnitude and it should work fine. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 15 Jun 2014 09:27 AM |
| I just tried monitoring it in a server test and the magnitude still goes above the required amount when it is moving, so it still should be firing. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 15 Jun 2014 09:49 AM |
| It's so strange - the desiredangles are being set but the current angles aren't automatically changing. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 15 Jun 2014 10:03 AM |
Ah! I found something!
If I pick up the golem and drop it from mid air, the animations start working again.
It just might be something with my movement script. |
|
|
| Report Abuse |
|
|
Xulp
|
  |
| Joined: 24 Apr 2012 |
| Total Posts: 451 |
|
|
| 16 Jun 2014 04:27 PM |
| I guess it's not.. but the humanoid's running event doesn't work for some reason. Any explanations? |
|
|
| Report Abuse |
|
|