klkljr
|
  |
| Joined: 14 Mar 2011 |
| Total Posts: 9823 |
|
|
| 25 Nov 2015 04:11 PM |
| I have two animations I want to play back to back. They both start and end in exactly the same position, but when the first one ends, the NPC enter the default idle stance before starting the second animation. Is there a fix for this? |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 25 Nov 2015 04:35 PM |
Roblox Animations are bad, I use CFrame and lerp functions. Here is a function I made for an FPS a while back.
tweenJoint = function(Joint,NewC0,NewC1,Duration) local StartC0 = Joint.C0 local StartC1 = Joint.C1 spawn(function() local tweenIndication = nil local NewCode = math.random(-1e9, 1e9) if (not Joint:FindFirstChild('TweenIndication')) then tweenIndication = Instance.new('IntValue') tweenIndication.Name = 'TweenIndication' tweenIndication.Value = NewCode tweenIndication.Parent = Joint else tweenIndication = Joint.TweenIndication tweenIndication.Value = NewCode end local num = 1/(Duration * game.Workspace:GetRealPhysicsFPS()) for i=0,1,num do if Joint:FindFirstChild('TweenIndication') and Joint:FindFirstChild('TweenIndication').Value == NewCode then Joint.C1 = StartC1:lerp(NewC1,i) Joint.C0 = StartC0:lerp(NewC0,i) game:GetService("RunService").RenderStepped:wait() elseif not Joint:FindFirstChild('TweenIndication') then error('Joint not found. Did your character die?') break else break end end if tweenIndication.Value == NewCode then tweenIndication:Destroy() end end) end |
|
|
| Report Abuse |
|
|
klkljr
|
  |
| Joined: 14 Mar 2011 |
| Total Posts: 9823 |
|
|
| 25 Nov 2015 05:43 PM |
welp, if that's the best way then I have a lot of stuff to learn...
Also, seeing as you have some experience with that, how long does it take to make animations? |
|
|
| Report Abuse |
|
|
klkljr
|
  |
| Joined: 14 Mar 2011 |
| Total Posts: 9823 |
|
|
| 25 Nov 2015 08:41 PM |
| I'll try out what you said, but I would really prefer to use ROBLOX's animation system. Bump jic anyone has a fix to my problem. |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 26 Nov 2015 09:26 PM |
not long, but you have to input the data in numbers, not physically. Like this:
module.IdleAnim = { AnimSpeed = .5, GunPosition = { CFrame.new(0,0,0) * CFrame.Angles(0,0,0), CFrame.new(0,0,0) * CFrame.Angles(0,0,0), CFrame.new(0,0,0) * CFrame.Angles(0,0,0), CFrame.new(0,0,0) * CFrame.Angles(0,0,0), }, RightArm = { CFrame.new(-.5,.5,-1) * CFrame.Angles(math.rad(-90),0,math.rad(-.5)), CFrame.new(-.5,.5,-1) * CFrame.Angles(math.rad(-90.5),0,math.rad(0)), CFrame.new(-.5,.5,-1) * CFrame.Angles(math.rad(-90),0,math.rad(.5)), CFrame.new(-.5,.5,-1) * CFrame.Angles(math.rad(-90),0,math.rad(0)), }, LeftArm = { CFrame.new(-.3,-.30,.5) * CFrame.Angles(math.rad(100),0,math.rad(40)), CFrame.new(-.3,-.30,.5) * CFrame.Angles(math.rad(100),0,math.rad(40)), CFrame.new(-.3,-.30,.5) * CFrame.Angles(math.rad(100),0,math.rad(40)), CFrame.new(-.3,-.30,.5) * CFrame.Angles(math.rad(100),0,math.rad(40)), }, } |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 09:27 PM |
| is there a wait() inbetween? if not, are they both "action" animations? |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 26 Nov 2015 09:41 PM |
>Roblox animations allow less freedom but are way easier for beginners, they're also a lot better for the fact that they don't require all of this code, and can be adjusted once the animation is made.
I.e. you can change the speed and weight of the animation.
However there are some things animations can't do (for example let's say you want to rotate the player's head to face the mouse's location) this would create a problem because it would be like making an animation for each degree your head is rotated, whereas you can simply use some CFrame action and change the C0 or C1.
Overall, I would suggest you use roblox animations for more complex things, and use CFrames only when it is necessary to have less threads running, the task scheduler doing less work, and to create a lack of scripts just lying around.
(That and animations can be played locally and update to the server with FE on) |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 09:44 PM |
@Isosta
Mind letting me look at how you did some things in Redux? I am okay if its an older version, I just want to see how you managed a double jointed arm, with both the bicep and fore-arm. |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 26 Nov 2015 09:45 PM |
| yeah sure, i'm just now getting back on roblox and will be rescripting the entire thing anyways |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 09:47 PM |
Okay, cool. Shoot me a PM?
(So you do not have to give away the place to them too) |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 09:48 PM |
"Roblox Animations are bad, I use CFrame and lerp functions."
For whatever stupid reason, changes to the character Motor6Ds don't replicate, which makes them an awful option for me.
Roblox animations aren't bad. I don't know why you'd say that. |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 09:49 PM |
@Long
Why don't you just use less detailed animations on the server and more detailed on client. |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
| |
|
|
| 26 Nov 2015 09:52 PM |
"Why don't you just use less detailed animations on the server and more detailed on client."
Unless I'm sending information to the server every 1/20 of a second via RemoteEvent, it's going to be choppy and ugly. |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 09:54 PM |
@Long
Uhm, no. Fire Mouse.Hit every like .3 seconds for it to update on, and have the server update it based off that every .Stepped
That way, its mostly always updated and it will be mostly up to date. (Speaking from experience, it isnt as bad as you think) |
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 26 Nov 2015 09:54 PM |
| >That moment when you don't think these skids understand |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 09:57 PM |
"Uhm, no. Fire Mouse.Hit every like .3 seconds for it to update on" Every .3 seconds is choppy.
"and have the server update it based off that every .Stepped" Umm, what? The server is not a client. The server does not have a frame rate. So how do I use an event which fires when a frame is rendered?
|
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 10:00 PM |
This is what I mean.....
--client
while wait(0.3) do re:FireServer(m.Hit) end
--server
local mousecframe
re.OnServerEvent:connect(function(p, mhit) mousecframe = mhit end)
game['Run Service'].Stepped:connect(function() --animate here, based off mousecframe end)
Makes perfect sense in my mind |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 10:02 PM |
| And yes, I do realize that method isn't perfect. I am just saying that it isn't always neccesary to be 100% up to date, as it would cause throttling to fire it too much. |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 10:03 PM |
The server has no frames to render.
You can't use the RenderStepped event on the server.
|
|
|
| Report Abuse |
|
|
mycheeze
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 6748 |
|
|
| 26 Nov 2015 10:03 PM |
:v if you're updating your motor6ds based on how the camera is facing, there is a much better way of doing this
>run loop and check if the difference is big enough from where the player was facing and currently is facing to prevent unnecessary remote event usage.
geez |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 10:05 PM |
@mycheeze
good points
@long
wtf are you stupid, I am using .Stepped, it works on the server |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 10:08 PM |
"wtf are you stupid, I am using .Stepped, it works on the server"
I give up. There's no hope for you. |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 10:10 PM |
Long, you are unhelpable. Let me link you to the wiki.
http://wiki.roblox.com/index.php?title=API:Class/RunService
Stepped works on the server, both Stepped and RenderStepped work on the client. |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2015 10:11 PM |
I don't know if this is a troll or not anymore
https://gyazo.com/92a6bb2762c42fcdad334609967928b7 |
|
|
| Report Abuse |
|
|