flysouth Posted June 12, 2016 Share Posted June 12, 2016 I am trying to figure out what kinds of things can mount to what.I have mounted ShapeBaseImageData to a vehicle without a problem.What if I wanted to create something like a train where I had many coaches that the player could choose from at run time. I have not figured out what object type allows for connecting to the same type.So in the train example the motor coach would be a vehicle. The next coach could be a ShapeBaseImageData object but then how do you connect the next coach, because as far as I worked out you cannot mount ShapeBaseImageData to abother ShapeBaseImageData.How would I go about connecting them all? :cry:Just to add... I dont want to make a train, thats just an example. What I would like to do is allow the player to build up obejects sort of like using lego. The main question is what objects in T3D allow more of the same type to me mounted / attached to them? Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 14, 2016 Author Share Posted June 14, 2016 Anyone got info on this or link where to find this info? Quote Link to comment Share on other sites More sharing options...
Johxz Posted June 14, 2016 Share Posted June 14, 2016 hey @flysouth sorry not sure if I understand you :) it seems something like Air Combat Starter Kit https://www.garagegames.com/products/macsk but with the missiles Quote Link to comment Share on other sites More sharing options...
Johxz Posted June 14, 2016 Share Posted June 14, 2016 check this link https://www.garagegames.com/community/forums/viewthread/142056https://www.garagegames.com/community/forums/viewthread/5312https://www.garagegames.com/community/forums/viewthread/126560https://www.garagegames.com/community/forums/viewthread/58806https://www.garagegames.com/community/resource/view/3925/9#commentsnow something like lego? Blockland is a game made with Torque where you can build stuff try to dowload the demo http://www.blockland.us/ I suppose you can attach stuff Quote Link to comment Share on other sites More sharing options...
JeffR Posted June 15, 2016 Share Posted June 15, 2016 The first thing, is I'd point out that ShapeBaseImage is primarily intended for use as mounted weapons.If you were trying to mount "real" objects, such that may have collisions or the like, you'd want to use a different class, such as ShapeBase, or the like.So for example, you have here:https://github.com/GarageGames/Torque3D/blob/7bba3ee2de610c2757bc70eba10db869bab72a85/Templates/Full/game/scripts/server/vehicle.cs#L98Which mounts the player to the vehicle at a given node slot.For your traincars, you'd Shapebase or the like for your cars, and mount them like the above call. Then as needed set their mountPos and mountRot fields to tweak their position(assuming you don't have a special node to mount them to specifically). These are added to the parent's transform.This way, when your vehicle moves, they will move with it. Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 15, 2016 Author Share Posted June 15, 2016 Thanks for the suggestions. I have experimented with player mounting, weapon mounting and trurret mounting to vehicles.The turret mounting seems to be broken - it mounts but is out of sync with the vehicle and I could not get it to do anything.I also tested the image mounting which too works fine but is not what I am looking for.Yes I am looking to mount real objects such that they may have collisions. Some of them will have to be mounted on vehicles.I will do some tests based on the information above and post my findings or questions here later. Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 15, 2016 Author Share Posted June 15, 2016 Okay I tried the following and it gave no errors but even though it shows that it is mounted to the vehicle, there is nothing visble on the vehicle.I just used a healthkit datablock datablock ItemData(Botx1) { category = "misc"; mountPoint = 0; className = "Botx1"; shapeFile = "art/shapes/BotStuff/botx1.DAE"; mass = 2; friction = 1; elasticity = 0.3; emap = true; pickupName = "a small thing"; repairAmount = 50; }; I then tried mounting it with the following code: function Bot1::onAdd(%this, %obj) { Parent::onAdd(%this, %obj) ... %obj.Btx1 = new Item() { dataBlock = Botx1; }; %obj.mountObject(%obj.Btx1, %this.SlotFront); } Any ideas what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
Azaezel Posted June 15, 2016 Share Posted June 15, 2016 Been tinkering with https://github.com/Azaezel/Torque3D/tree/mountAugs for a while. (game excerpts so might be missing bits) one of em's item-related. If folks wanna beat it up a bit, could be persuaded to PR it as-is. Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 15, 2016 Author Share Posted June 15, 2016 Thanks Azaezel.I am trying to do this without modding the c++. I changed my above code to use a StaticShapeData object and I see it suffers with the same problem as the Turret. It does not stay in sync with the moving vehicle.This is so frustrating. What do people do with this engine?? Wait let me guess.... the change the c++ to make it work :(@JeffR - does version 4 sort this stuff out or does it just continue with more of the same? Quote Link to comment Share on other sites More sharing options...
Azaezel Posted June 15, 2016 Share Posted June 15, 2016 This is so frustrating. What do people do with this engine?? Wait let me guess.... the change the c++ to make it work :(@JeffR - does version 4 sort this stuff out or does it just continue with more of the same?Bit of a catch 22 there. Engines in a state where folks gotta be wiling and able to throw source mods over so they don't have to touch that area anymore (unless of course it's one of those things that does need tight performance). Fewer folks willing to pitch in on that front, longer it takes. Quote Link to comment Share on other sites More sharing options...
JeffR Posted June 16, 2016 Share Posted June 16, 2016 Thanks Azaezel.I am trying to do this without modding the c++. I changed my above code to use a StaticShapeData object and I see it suffers with the same problem as the Turret. It does not stay in sync with the moving vehicle.This is so frustrating. What do people do with this engine?? Wait let me guess.... the change the c++ to make it work :(@JeffR - does version 4 sort this stuff out or does it just continue with more of the same? Yeah, the entities are being intended to be very flexible, especially with the mounting. I'll have a look at the static shape mounting bit, it's not as flexible as it should be, but it definitely should at least keep up with the mount object. It sounds like the interpolation isn't handling it correctly as is, which means it's likely a bug.With 4.0, the general ethos is going to be more of a "You shouldn't have to use the source unless you're optimizing for performance, or crazy specialized stuff, but general gameplay shouldn't require source changes. Source is there to make things shiney and fancy, not to get the game running". Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 16, 2016 Author Share Posted June 16, 2016 Fewer folks willing to pitch in on that front, longer it takes.It would be easier to get involved if there was some sort of class diagram so that one could get a better idea of how all the bits fit together.What I find strange is that many of these fixes have already been done by various people years ago but the fixes have never been put into the 'official' release.It seems almost that some of these things are being fixed again and again by different people :shock: Quote Link to comment Share on other sites More sharing options...
Azaezel Posted June 16, 2016 Share Posted June 16, 2016 Yeah, used to be a largeish library of resources on the legacy forums back when it was a paid product. Unfortunately, quite a few went 404. So.Speaking of not wanting to have to touch source: few mounting related script utils:animated mount chain animation linking (everything in the iterative mount chain plays the same animation simultaneously): function smartPlayThread(%obj,%anim,%direction) { if (!isObject(%obj)) return; %obj.inTransition = true; if (%direction) { %obj.stopThread(0); %obj.playThread( 0,%anim ); %obj.setThreadDir(0,true); } else { //play deployment backwards %obj.stopThread(0); %obj.playThread( 0, %anim ); %obj.setThreadPosition(0,1); %obj.setThreadDir(0,false); } %count = %obj.getMountedObjectCount(); for (%i=0; %i<%count; %i++) { smartPlayThread(%obj.getMountedObject(%i),%anim,%direction); } } root mount chain finding function findRootObject(%obj) { if (!isObject(%obj)) return -1; %ret = %obj; if (isObject(%obj.getObjectMount())) %ret = findRootObject(%obj.getObjectMount()); return %ret; } full chain cleanup: function killMountchain(%obj) { if (!isObject(%obj)) return; %count = %obj.getMountedObjectCount(); for (%i=0; %i<%count; %i++) { if (isObject(%obj.getMountedObject(%i))) killMountchain(%obj.getMountedObject(%i)); } %obj.schedule(0,"delete"); } all parts damaged evenly: function setMountChainDamage(%obj,%damagePercent) { if (!isObject(%obj)) return; %count = %obj.getMountedObjectCount(); for (%i=0; %i<%count; %i++) { if (isObject(%obj.getMountedObject(%i))) setMountChainDamage(%obj.getMountedObject(%i),%damagePercent); } %obj.setDamageLevel(%obj.getMaxDamage()*%damagePercent); } Do note these'll likely be considered legacy come 4.0 specs. Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 16, 2016 Author Share Posted June 16, 2016 @Azaezel - Thanks for the scripts. Do you perhaps have a simple example of how you would use them?It looks like the code fix might be here? Or has this already become part of current code - and just does not work as it should?https://github.com/GarageGames/Torque3D/issues/680 Quote Link to comment Share on other sites More sharing options...
Azaezel Posted June 16, 2016 Share Posted June 16, 2016 function ProjectileData::onCollision(%this,%obj,%col,%fade,%pos,%normal,%hitbox) { if((!isObject(%obj))||(!isObject(%col))) return; if (%col == %obj.sourceObject) return; //echo("ProjectileData::onCollision("@%data.getName()@", "@%proj@", "@%col.getClassName()@", "@%fade@", "@%pos@", "@%normal@", "@%hitbox@")"); if ((%col.dataBlock.category $= "RigidShape")||(%col.dataBlock.category $="Turrets")) { if (%obj.sourceObject.dataBlock.category $= "bots") %col.lastDamager = %obj.sourceObject; } if (findRootObject(%col).team == %obj.team) { if (%obj.getDataBlock().heals) %damage = -%this.directDamage; } else %damage = %this.directDamage; ...more game specific stuffs... } for one example function ShapeBaseData::damage(%this, %obj, %source, %position, %amount, %damageType) { // Ignore damage by default. This empty method is here to // avoid console warnings. %damagePercent = %obj.getDamagePercent(); setMountChainDamage(%obj,%damagePercent); } for anotheranimation one should be self-evident.edit: and yeah, had forgotten about that fork... Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 16, 2016 Author Share Posted June 16, 2016 animation one should be self-evident. - nope - I am still at the beginning of this journey :| Quote Link to comment Share on other sites More sharing options...
Azaezel Posted June 16, 2016 Share Posted June 16, 2016 smartPlayThread(%obj,"open",true); where %obj is an object identifier for a root, an "open" animation exists in all of the mounted objects, and true for play forwards. Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 16, 2016 Author Share Posted June 16, 2016 The question is how would I call this? For example if I had a vehicle with all sorts of things mounted to it. Is there some way of intercepting the standard animation call? Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 27, 2016 Author Share Posted June 27, 2016 and the answer is? Quote Link to comment Share on other sites More sharing options...
JeffR Posted June 28, 2016 Share Posted June 28, 2016 Not sure about intercepting, but an example would be like, suppose you had a weapon with a bunch of mounted attachments that you want to do something when you reload(have little dodads move, etc)So each of those would have a "reload" animation. Then you'd use the smartPlayThread(%myGun,"reload",true); to tell the gun to play the reload animation, but it would also iterate over all the mounted objects and tell them to play their reload animations as well.This would let you have all your attachments do their little dodad animations upon the gun being reloaded, as per the example.Hopefully that explains the idea. If not, is there a particular scenario you're thinking of? Quote Link to comment Share on other sites More sharing options...
flysouth Posted June 28, 2016 Author Share Posted June 28, 2016 Thank for the explanation JeffR.I wish to create a 'vehicle' with various bits that attach as the game proceeds. Some of the bits need to be animated, but hopefully they are more than just an image ie. they can detect collisions etc. I have tried various things but apart from images everything else seems to have an issue staying in sync with the vehicle when it moves.For various reasons I dont really want to mod the C++ to get this working. I am currently busy with the artwork and am hoping ver 4 comes out soon and fixes some of my problems :lol: Quote Link to comment Share on other sites More sharing options...
JeffR Posted July 2, 2016 Share Posted July 2, 2016 I merged in some improvements to the mounting a week or two back, so if Johzx's binaries are up to date, it should include those improvements.You'll still see some jittery behavior if you have a chain of mounted objects, like a scope mounted onto a gun mounted onto a vehicle, and when the vehicle moves, the scope'll lag behind some, but the improvements helped with at least the first-step mounted objects to keep up better(and allow most classes to do it, even the TSStatics).So I'd say check with Johzx on if his precompiled binary is up-to-date and give it a whirl with the mounting improvements in there and lemme know if that helps. Quote Link to comment Share on other sites More sharing options...
flysouth Posted July 3, 2016 Author Share Posted July 3, 2016 Thanks I will do that Quote Link to comment Share on other sites More sharing options...
flysouth Posted July 21, 2016 Author Share Posted July 21, 2016 Where can I find documentation that shows smartPlayThread() ?ie Where are the latest docs? Quote Link to comment Share on other sites More sharing options...
Azaezel Posted July 21, 2016 Share Posted July 21, 2016 It's pure raw script. Figured toss you something that *didn't* touch the c side for a change there. If you want the internal documentation for the methods used inside, check https://github.com/GarageGames/Torque3D/blob/963ef1ecdbe0c1fc427d50156d1a46e78b523988/Engine/source/T3D/shapeBase.cpp#L3645 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.