View Full Version : Problem with conveyor style cogs
money•bie
04-10-2005, 10:43 PM
When I've recently gone to make a rounded waterfall (i.e., the trajectory of the waterfall is protrusive, so as to seem realistic), I've noticed that basic conveyer cogs seem to animate the surfaces at different speeds (basically, the larger surfaces are slower than those small). So, to cut to the chase, I'm having trouble manipulating the cogs to make the surfaces animate in concordance.
Daft_Vader
04-11-2005, 12:10 AM
I vaguely recall Halucid/SniperWolf working on a cog that dealt with conveyors on sloped surfaces. I may be misunderstanding you, but ask one of them. I'll look around a bit for the thread.
CavEmaN
04-11-2005, 12:11 AM
Scroll down to SniperWolf's last few posts.
click (http://forums.massassi.net/vb/showthread.php?s=&threadid=11993)
Daft_Vader
04-11-2005, 12:13 AM
[-]Here it is!
http://forums.massassi.net/vb/showthread.php?s=&threadid=11993&highlight=conveyor[/-]
Curse you CavEmaN, I'll get you !!!!
ORJ_JoS
04-11-2005, 02:10 AM
I noticed that scrolling surfaces never seem to properly line up, even though I line them up in Jed =\ *goes to link*
money•bie
04-11-2005, 08:32 AM
That's exactly what I was looking for, thanks! I had actually come to the same conclusion as halucid and had tried the same method he suggested where each surface had their own vector, but, strangely, it didn't work. I’d put it down to the fact that my math -> cog skills are, shall we say, unrefined.
money•bie
04-11-2005, 09:10 PM
Weird, I finally got the chance to use it, and it doesn't work.
# Jedi Knight Cog Script
# Jedi Knight Cog Script
#
# 00_conveyor.cog
#
# generic conveyor belt script
#
# This script will control 1-8 conveyor belts moving in the same direction
# and with the same velocity. The conveyors run continuously.
#
# [IS]
#
# LKOH_SniperWolf
# 07/2004
# Updated to slide selected surfaces the X & Y, in relation to the surface itself.
# Same effect as changing position of texture in 2d relations.
# Positive X is to the right, positive Y is up. These act as vector components, and so an
# amount. IE, X:5 Y:5 will have a greater effect than X:1 Y:1
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ================================================== ======================================
symbols
message startup
float X desc=conveyor_x_direction
float Y desc=conveyor_y_direction
vector vec0 local
vector newVec local
vector tempVec local
vector tempVec2 local
float speed=2.0 desc=conveyor_speed
surface convey0 nolink
surface convey1 nolink
surface convey2 nolink
surface convey3 nolink
surface convey4 nolink
surface convey5 nolink
surface convey6 nolink
surface convey7 nolink
int garbage local
int cnt local
end
# ================================================== ======================================
code
startup:
for (cnt = 0; cnt<=7; cnt=cnt+1){
if (convey0[cnt] >= 0){
// The following uses various calculations to create a new vector appropriate for the surface
// Basically, it just creates a new vector already aligned to the conveyor surface, and uses it to slide
// the surface the X and Y in the inputted vector relative to the surface.
tempVec = VectorCross(GetSurfaceNormal(convey0[cnt]), '0 0 -1');
if ((VectorX(GetSurfaceNormal(convey0[cnt]) == 0) && (VectorY(GetSurfaceNormal(convey0[cnt]) == 0)){
tempVec = VectorCross(GetSurfaceNormal(convey0[cnt]), '0 -1 0');
}
tempVec = VectorNorm(tempVec);
vec0 = VectorSet(X*VectorX(tempVec), X*VectorY(tempVec), X*VectorZ(tempVec));
tempVec = vec0;
tempVec2 = VectorCross(GetSurfaceNormal(convey0[cnt]), tempVec);
tempVec2 = VectorNorm(tempVec2);
vec0 = VectorSet(Y*VectorX(tempVec2), Y*VectorY(tempVec2), Y*VectorZ(tempVec2));
tempVec2 = vec0;
newVec = VectorAdd(tempVec, tempVec2);
garbage=slidewall(convey0[cnt], newVec, speed);
}
}
return;
end
LKOH_SniperWolf
04-12-2005, 12:15 AM
Looks like you didn't copy correctly. From the looks of it, the forums messed up one of the lines...
# ==================================================
======================================
That all needs to go on one line. Otherwise, the === aren't properly commented out, and the cog won't work.
money•bie
04-12-2005, 09:48 AM
Actually, I corrected that in the final cog file. It's just something it does everytime you subject it to [code] brackets.
But maybe there's something else eluding me that was screwed up by the forums. Help? :\
zagibu
04-12-2005, 01:27 PM
Yeah, it messed up your <> signs on code line two and three.
money•bie
04-12-2005, 01:57 PM
Er.. I don't see what you're talking about. Would ya mind editing it in Notepad or whatever and attaching it?
LKOH_SniperWolf
04-12-2005, 05:37 PM
Try this. It should work. I think I got all the forum stupidities out...
LKOH_SniperWolf
04-12-2005, 05:48 PM
Just change the extension, and it SHOULD work, unless I'm missing something...
money•bie
04-12-2005, 09:27 PM
Still doesn't work. :\ I'll probably just end up doing away with the curved waterfall if I can't figure out the problem.
LKOH_SniperWolf
04-12-2005, 11:05 PM
Fixed... Apparently after halucid got it, I modified it slightly. Because of the way the vectors were done, this left an error if the X chosen was 0. This has been fixed. The appropriate file is attached below. You should have no problems whatsoever. (This has gone through several more tests. (I should note, I don't think in original testing, 0 was ever used for X...))
money•bie
04-13-2005, 12:30 AM
I gotta say, I really appreciate your persistence. It works bootifully.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.