SwayOn" for .DTS (from folliageReplicator)
by Infinitum3D · in Torque Game Engine · 08/15/2008 (5:59 am) · 13 replies
The foliage replicator has a "sway" feature to allow the grasses, plants, etc sway as if in a breeze.
How can I create or apply a similar effect to a .dts?
I'm trying to make a small wooden sign, hanging from a couple chains, which would sway back and forth.
Thanks!
Tony
How can I create or apply a similar effect to a .dts?
I'm trying to make a small wooden sign, hanging from a couple chains, which would sway back and forth.
Thanks!
Tony
#2
08/15/2008 (7:43 am)
And also.. isnt the foilage replicator sway different (as its a texture) vs the shape replicator (which is a DTS) in the case of a single animated object. Very simply right a script/datablockfor the DTS object and have the odadd commands for your editor to recognize it. And it will play the idle animation by default. Cool eh.
#3
@Stephan - I'm trying to avoid creating an animation (because I stink at it) so I though just a swayOn function would be easier. But thanks for the resource tip. I'll check into it. Where can I find the swinging chained lamp?
@Edward - I can use a single texture.png as a flag banner rather than a true shape.dts if it can be torqueScripted. If I have to C++ it as a plug-in, then I'm out of luck.
Tony
I'll look into both...
08/15/2008 (10:11 am)
Thank you both for your help.@Stephan - I'm trying to avoid creating an animation (because I stink at it) so I though just a swayOn function would be easier. But thanks for the resource tip. I'll check into it. Where can I find the swinging chained lamp?
@Edward - I can use a single texture.png as a flag banner rather than a true shape.dts if it can be torqueScripted. If I have to C++ it as a plug-in, then I'm out of luck.
Tony
I'll look into both...
#4
@Edward - Can you give an example? Are you saying I can write a function that calls the SwayOn animation?
Something like...
datablock BannerData(WavingBanner)
{
textureName = "~/banner";
swayOn = "true";
};
???
Tony
08/15/2008 (12:17 pm)
@Stephan - I couldn't find the swinging lamp. Is it in a mission? or is it a .cs file with .dsq's?@Edward - Can you give an example? Are you saying I can write a function that calls the SwayOn animation?
Something like...
datablock BannerData(WavingBanner)
{
textureName = "~/banner";
swayOn = "true";
};
???
Tony
#5
exec("~/data/shapes/wavingflag.cs"); // refer toyour player.cs for setup
datablock PlayerData(WavingFlag : OrcWarriorAvatar)
{
shapeFile = "~/data/shapes/Flags/WavingFlag.dts";
className = "Humanflag";
category = "Flags";
//mass = 85;
// maxEnergy = 100;
//rechargeRate = 0.1;
};
This should work as long as your .cs file is setup with the correct animations.
there is another portion... but I cant find it right now. That should get you started.
08/15/2008 (12:38 pm)
First thing you must do is somewhere load the objects animation and its root. this is a example of stationary gaurd with 1 animation that stands there and looks around. (we also have code for dialogue but in this case will work fine)exec("~/data/shapes/wavingflag.cs"); // refer toyour player.cs for setup
datablock PlayerData(WavingFlag : OrcWarriorAvatar)
{
shapeFile = "~/data/shapes/Flags/WavingFlag.dts";
className = "Humanflag";
category = "Flags";
//mass = 85;
// maxEnergy = 100;
//rechargeRate = 0.1;
};
This should work as long as your .cs file is setup with the correct animations.
there is another portion... but I cant find it right now. That should get you started.
#6
Is there no way to torqueScript a SwayOn function without writing a .cc file like fxFolliageReplcator?
It doesn't look like it would take much to change the existing folliage replicator to a single texture "waver", but I'm no programmer.
Anyone up to the task :)
Tony
08/15/2008 (12:58 pm)
OK, so it does need a .dsq animation.Is there no way to torqueScript a SwayOn function without writing a .cc file like fxFolliageReplcator?
It doesn't look like it would take much to change the existing folliage replicator to a single texture "waver", but I'm no programmer.
Anyone up to the task :)
Tony
#7
08/15/2008 (1:00 pm)
Well the swayon function as you mention is a engine function, rather then a purely script thing. You dont have to have a DSQ, you can imbed the animation into the model and call it as such. have your root and idle animation. And your good to go.
#8
@Infinitum3D: The swaying lamp model is found at: starter.fps/data/shapes/lightingPack, and you can see it in action in the sgLightingPackdemo mission included within the starter.fps.
It's simply an animated spotlight that swings back and forth. The actual sequence name can be whatever you wish it to be when you create the animation but you have to be sure that you call that name in your shape's onAdd function.
It would be possible to take an object and script hack an animation behaviour for it by finding a point offset from it's center and rotating it on a particular axis at that point through scheduled iterations. But, that could be process intensive depending on how often the schedule is called, and if you don't call it often enough then your scripted animation would appear jerky.
08/15/2008 (1:37 pm)
The foliage replicator programmactically sways the texture. Doing so with a model is a whole other ballgame. The simplest and easiet way to animate a .dts is to create an animation sequence for it. @Infinitum3D: The swaying lamp model is found at: starter.fps/data/shapes/lightingPack, and you can see it in action in the sgLightingPackdemo mission included within the starter.fps.
It's simply an animated spotlight that swings back and forth. The actual sequence name can be whatever you wish it to be when you create the animation but you have to be sure that you call that name in your shape's onAdd function.
function swingingObject::onAdd(%this, %obj)
{
%obj.playthread(0, "animationSequenceName");
}It would be possible to take an object and script hack an animation behaviour for it by finding a point offset from it's center and rotating it on a particular axis at that point through scheduled iterations. But, that could be process intensive depending on how often the schedule is called, and if you don't call it often enough then your scripted animation would appear jerky.
#9
08/15/2008 (2:42 pm)
Thanks mike thats the funtion i was looking for. I just was a bit busy and couldnt find it on demand.
#10
I was hoping to just script something. Since that doesn't seem possible, I could rewrite the folliageReplicator to do a simple sway animation for a single texture.png and make it a plug-in or add on .cc, but I'm not really any good at C++.
Neither option is what I wanted, but if those are my only two choices, then I'll have to try them.
Thanks to all for their help. I appreciate it greatly!
Tony
08/15/2008 (8:37 pm)
Well, I guess I wasn't clear enough in my earlier posts. I know how to call an animation. I don't know how to create the animation in Max or Maya.I was hoping to just script something. Since that doesn't seem possible, I could rewrite the folliageReplicator to do a simple sway animation for a single texture.png and make it a plug-in or add on .cc, but I'm not really any good at C++.
Neither option is what I wanted, but if those are my only two choices, then I'll have to try them.
Thanks to all for their help. I appreciate it greatly!
Tony
#11
Is the sgLightingPackDemo in 1.4.2? If so, I can dl it. I have access to both 1.5.2 and 1.4.2.
Thanks!
Tony
08/18/2008 (8:14 am)
@SilentMike - Unfortunately, I don't have sgLightingPackDemo. I have 1.5.2 which has Lighting System Featur Demonstration (no swinging lamp).Is the sgLightingPackDemo in 1.4.2? If so, I can dl it. I have access to both 1.5.2 and 1.4.2.
Thanks!
Tony
#12
08/18/2008 (11:50 am)
@ Infinitum3d: I was looking at the .mis name, it shows up in the mission listing as the Lighting System Feature Demonstration. Load it up, go into the building, take a left and at the first corner look up.
#13
Tony
08/18/2008 (11:57 am)
@Mike - its weird. Mine doesn't have a building. Just a glowing green lake...Tony
Torque Owner Stephan - viKKing - Bondier
Check out the swinging chained lamp provided in TGE.