Space Engineers

Space Engineers

Anima Examples
26 Comments
ColdWolf 20 Apr, 2017 @ 7:25pm 
Perfect, all I needed to know. Thanks a lot! :)
Justburner  [author] 20 Apr, 2017 @ 7:07pm 
Any block can be animated but the issue is that it's impossible to check if a player is looking inside a specific container from the ModAPI. (that's as far i know, didn't checked the API for nearly a year or so!).

Anyway there's a workaround that works similar, the ModAPI do have access to the inventory contents so if you have a script that monitors the content of your crate for changes it can tell if any player (or incidentally a conveyor or something) is messing around and animate a "open", for the "close" it could be performed after a certain period of inactivity after being opened... overall not a perfect solution but still good enough.

Anyway to do all that you need to know quite a bit of scripting or find someone who can help you in that.
ColdWolf 20 Apr, 2017 @ 1:07pm 
Just a quick question, if it isn't too much trouble.
I'm more modeller/animator than scripter, so I'm unsure of the possibilities!

Is it possible to get ANY block to animate, or just powered/etc blocks?
For example, if I wanted to get a crate to play an opening or closing animation when
the player is looking inside it or leaving it, would that be possible?

Justburner  [author] 16 Mar, 2017 @ 5:24pm 
Radar? You mean the Holographic Radar? You should ask the question there.
PrimOak6 16 Mar, 2017 @ 4:00pm 
Justburn is there a way we can use the radar on a different grid such as I Scouting prob
Justburner  [author] 9 Jun, 2016 @ 12:29am 
Sorry for the break-up on the examples due to keen moving some stuff into other namespaces... once again!...
Now they should be working again (as 1.137)
The anima script itself was completely unaffected.
Justburner  [author] 16 Apr, 2016 @ 10:56am 
This is found in the documentation: "If you see a black box in the place of your part that means Anima failed to read the model file, since File/Directory existance checks are blacklisted in the game the Anima script sadly can't tell you what went wrong, if you're using local mod make sure the altModName in m_anima.Init() point to the exact folder name of your mod, if you uploaded into the Workshop make sure the name you published is the same as in modName in m_anima.Init()."
Darth Biomech 5 Apr, 2016 @ 9:33am 
What to do if the script shows no error, but subpart is not spawning either? Name of model appears to be correct
Darth Biomech 22 Jan, 2016 @ 12:51pm 
Oh. So it is a text file then? Good, then I belive I can simalate it, yes. Thanks.
Justburner  [author] 22 Jan, 2016 @ 12:04pm 
Darth Biomech: Blender script only exports the keyframe data (position, rotation and scale) from the animation into a sequence class.
If you know how to write 3DS Max scripts you can replicate that without any troubles.

Alternatively you can specify your own transformations for each part manually without any need to attach a sequence.
Darth Biomech 22 Jan, 2016 @ 12:29am 
What exactly script for Blender does to a model? Maybe if I will know it I will understand if I can go on without it)
Justburner  [author] 21 Jan, 2016 @ 10:55am 
DraygoKorvan: Again? Just fixed a refactoring in the previous week patch. :/
DarthBiomech: Sorry, the script is for Blender only, there's no custom tags or anything... i'm sure Maya or 3DSMax can be supported but they are commercial applications so i don't have access to those =/
Anyway you can try to import your animation to Blender (I assume FBX support animation information) and export from there.
DraygoKorvan 21 Jan, 2016 @ 10:45am 
JustBurn, keens update broke your code due to some refactoring.
just add
using VRage.Game.Entity; to your anima.cs and your example that uses MyEntity.
Darth Biomech 21 Jan, 2016 @ 2:14am 
Does Blender Absolutely neccessary for exporting model for this script to work? Does it add some sort of tags into FBX?
Justburner  [author] 21 Jan, 2016 @ 12:05am 
Oh ops, did the DS test on Init but forgot on Update.
Thanks DraygoKorvan for pointing that out, the examples are patched and should be working on DS now =)
DraygoKorvan 20 Jan, 2016 @ 8:33pm 
JustBurn

I identified a crash issue in your code.

In UpdateBeforeSimulation() you do not null check m_anima, this causes a crash in block mods that set the Entity.NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;
Which will in turn cause your UpdateBeforeSimulation to be called.

On dedicated servers m_anima will be null resulting in a NullReference Exception.

Fix by simply adding a if(m_anima == null) return; in the UpdateBeforeSimulation method.
DeAnti 13 Jan, 2016 @ 10:29pm 
so cool, would love to see more examples
Justburner  [author] 12 Jan, 2016 @ 9:51am 
Skinned Mesh Animation (or Skeletal animation) is not related to texture but related to bones, like your engi moving your arms and legs, deforming the surface which is the "skin".
Also is not possible to do texture animation without a texture matrix (the game doesn't use one) or changing the texture in a material on the fly (Mod API doesn't allow that).
And yep, this script is limited to objects tranformations only: Position, Rotation and Scale.
Darian Stephens 12 Jan, 2016 @ 9:17am 
So, does the 'it cannot do skinned animation' mean that you can only move parts of the object; no texture animation?
Justburner  [author] 8 Jan, 2016 @ 8:27pm 
Thanks, it will be very interesting to see what the modders will come up with this =)
Shaostoul 8 Jan, 2016 @ 5:27pm 
JustBurn, this is amazing and I am very thankful for this. I shall have to play with it. I sent you a friend request, just in case.
SEModder4  [developer] 8 Jan, 2016 @ 1:19pm 
@JustBurn,

Love the model :D

Animated blocks sounds freaking amazing :D
harber33. 8 Jan, 2016 @ 10:51am 
i would ask him but dont know how.
Justburner  [author] 8 Jan, 2016 @ 10:23am 
Completely out of context. That has nothing to do with this script xD
Why don't you ask in the game's forum instead?
Anyway only KeenSWH can remove the button from the official game.
harber33. 8 Jan, 2016 @ 9:53am 
hello can you make a mode that gets rid of that button that says convert to ship. It keeps laging up the servers when players convert the stations on the planets to ships. This would be a great hepl to alll server operators. Thank-you. Harber33