• VMFII - Use Instances in Source 2009 and Below
    48 replies, posted
I'm not sure if I'm doing something wrong or of this is a bug. I'm trying to parent a point_viewcontrol entity to a physics object and it does not seem to work with instances. Because of a parenting bug with point_viewcontrol's they can only be parented using triggers. I have a trigger_once set up to do this. [img]http://i.imgur.com/83ddp.png[/img] I added this to the entities.txt [img]http://i.imgur.com/egrDb.png[/img] am I doing anything wrong here? the instanced point_viewcontrol activates just fine but it does not seem to become parented.
I think I know what the problem is, and I think I can fix it. I'm pretty deep into quite a lot of coursework at the moment, but I'll have a go when I have the time.
Alright, I have a few minutes. I'll try and fix both bugs now.
Go ziks go! Just discovered this, thanks.
I'm changing entities.txt to work like this: [code]{ "properties" : { "func_button" : { "movedir" : "angle" }, "func_door" : { "movedir" : "angle" } }, "inputs" : { "SetParent" : "entity" } }[/code] I'll try and support the old style but you should probably change it to this style anyway. [editline]22nd January 2013[/editline] I won't be able to test and finish it until [url=http://facepunch.com/showthread.php?t=1160464&p=39316207&viewfull=1#post39316207]this[/url] is fixed, sorry guys.
New version: [url]https://github.com/Metapyziks/VMFInstanceInserter/raw/master/builds/latest.zip[/url] This should fix overlays, although I've only done a few tests. I'll try and fix the output entity name problem now.
Any luck with getting your Hammer to work?
I've got it in a useable state but it doesn't work for GMod yet. I accidentally uploaded an old build, but that's fixed now. Also, that build includes a fix for Stinger21's problem too.
Something to look out for if anyone is using the newest version: I changed the -cleanup command line arg to --cleanup (or -c), if you don't correct that then vvis will fail to find any new builds of the map.
There's been quite a few more bug fixes, and Skotty has expanded entities.txt by quite a lot.
Pretty major update: turns out my rotation system was pretty broken, and only worked with the simplest cases (like only rotating on one axis). I'm surprised it wasn't spotted earlier, and thanks to [url=http://steamcommunity.com/id/marnamai/]marnamai[/url] for finding it. I've fixed it, and it seems to work for all cases. What's more, it looks like even Valve got it wrong with the collapse entities tool in Hammer, so that's another benefit of this tool if you are doing complex rotations.
Could you go into more detail on what was going wrong with the rotations?
Well (as you know) Hammer stores rotations as three numbers, roll, pitch and yaw which rotate on the X, Y and Z axis respectively. When rotating an object, it is first rolled, then pitched, then yawed (the order is important). Problems arise when you want to combine two rotations. Each object in your instance has its own roll, pitch and yaw; and the instance entity itself has a roll, pitch and yaw too. When you use VMFII (or collapse the instance in Hammer) each object needs to combine its own rotation with that of the instance it is in. Initially I assumed that simply adding the rolls, pitches and yaws would work. So: [code]Ent rotation = (re, pe, ye) Instance rotation = (ri, pi, yi) New rotation = (re + ri, pe + pi, ye + yi)[/code] Now, this works in some simple (and common) cases such as only having rotations on one axis, or having no rotation for the ent and any rotation for the instance, etc. But THIS DOES NOT WORK IN GENERAL. Try making an instance with some object rotated (45, 45, 45). Now, in a new map, place that instance with the rotation being (-45, -45, -45). So the combined angle of the object should be (45 - 45, 45 - 45, 45 - 45) = (0, 0, 0) right? The hell it is, shits all skewed. What's more, try collapsing the instance using Hammer. What? The thing changed rotation? Yep, now it's (73.1579 165.361 -165.361). So I spent a weekend doing some maths and worked out exactly how to combine the two rotations, which involved finding the rotation matrix for both, multiplying them, then extracting the new yaw, pitch and roll.
Another bugfix, and func_breakable_surf should now work since I added a ruleset for them in entities.txt.
Simple displacements now work for all rotations, although I haven't done much testing on them yet.
Appreciate the work you're putting in to this, keep it up.
This is a pretty big update: now VMFII can use FGD files instead of entities.txt to work out how to fix up entities. I haven't done much testing, and I've only done it for properties and not inputs for the moment. To use FGDs you will need to put vmfii.exe in the bin/ folder for whatever hammer version you are using, the same folder that contains the main FGD files like halflife2.fgd and base.fgd. Then, add to the end of the command line arguments "--fgd <path to FGD file>". For example, my command looks like: [code]"C:\Program Files (x86)\Steam\steamapps\<steam name>\sourcesdk\bin\source2009\bin\vmfii.exe" $path\$file.$ext $path\$file.temp.$ext --fgd "C:\Program Files (x86)\Steam\steamapps\<steam name>\garrysmod\garrysmod\gamemodes\finalfrontier\finalfrontier.fgd"[/code]
Though I have no use for this tool myself, I've been following it for some time. This FGD thing is bound to come in useful; nice job!
Sorry, you need to Log In to post a reply to this thread.