lfnetwork.com mark read register faq members calendar

Thread: Arrow trajectory
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 03-22-2008, 02:36 PM   #1
XycaleTh
Rookie
 
XycaleTh's Avatar
 
Join Date: Apr 2006
Location: UK
Posts: 67
Arrow trajectory

Hi, I've modded the game so I can fire an arrow from a long bow, but the problem I'm having is making the arrow point towards the direction its traveling in. If you fire the arrow as it is now at, say, a 45 degree angle, it will remain at 45 degrees until it hits an object and then sticks into it at the angle the arrow was traveling at as the arrow hit it.

So any ideas?
XycaleTh is offline   you may: quote & reply,
Old 03-22-2008, 07:16 PM   #2
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
A little confused, is it traveling in the right angle and not sticking in the right angle?


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Old 03-23-2008, 06:49 AM   #3
XycaleTh
Rookie
 
XycaleTh's Avatar
 
Join Date: Apr 2006
Location: UK
Posts: 67
Maybe I didn't make myself very clear :s So here's a little diagram of what I'm trying to do ^_^

http://img.photobucket.com/albums/v4...h/bow_shot.jpg

The first one is what's happening at the moment. The second one is what I want to happen
XycaleTh is offline   you may: quote & reply,
Old 03-23-2008, 11:27 AM   #4
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Which TR type?

You'll need to modify the missile angle as it travels somehow.


iojamp project lead / coder

Last edited by ensiform; 03-23-2008 at 11:37 AM.
ensiform is offline   you may: quote & reply,
Old 03-23-2008, 12:38 PM   #5
XycaleTh
Rookie
 
XycaleTh's Avatar
 
Join Date: Apr 2006
Location: UK
Posts: 67
Using TR_GRAVITY as the TR type for the arrow. I've had a look at ent->s.apos but haven't had much luck with it.
XycaleTh is offline   you may: quote & reply,
Old 03-24-2008, 06:15 AM   #6
XycaleTh
Rookie
 
XycaleTh's Avatar
 
Join Date: Apr 2006
Location: UK
Posts: 67
Found a possible solution, which I've based off the direction changing for the homing missile.

g_missile (G_RunMissile):
Code:
	if ( tr.startsolid || tr.allsolid ) {
		// make sure the tr.entityNum is set to the entity we're stuck in
		trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, ent->r.currentOrigin, passent, ent->clipmask );
		tr.fraction = 0;
	}
	else {
		VectorCopy( tr.endpos, ent->r.currentOrigin );
	}
Now looks like:
Code:
	if ( tr.startsolid || tr.allsolid ) {
		// make sure the tr.entityNum is set to the entity we're stuck in
		trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, ent->r.currentOrigin, passent, ent->clipmask );
		tr.fraction = 0;
	}
	else {
		VectorCopy( tr.endpos, ent->r.currentOrigin );

		// [NDA] - Rotate arrow to simulate heavier arrow head
		if ( ent->s.weapon == WP_BOW && ent->s.pos.trType == TR_GRAVITY && !(ent->flags & FL_BOUNCE_SHRAPNEL) )
		{
			// We're still in the air
			VectorCopy (ent->r.currentOrigin, ent->s.pos.trBase);
			BG_EvaluateTrajectoryDelta (&ent->s.pos, level.time, ent->s.pos.trDelta);
			ent->s.pos.trTime = level.time;

			SnapVector (ent->s.pos.trDelta);
		}
		// [/NDA]
	}
The arrow has FL_BOUNCE_SHRAPNEL added to its flags if it hit something at a very shallow angle so it doesn't stick.

I was hoping that it could be client-side predicted as well seeing as the arrow has a predetermined path. I'm happy with this solution but I'm sure there's a better one somewhere
XycaleTh is offline   you may: quote & reply,
Old 03-24-2008, 05:00 PM   #7
Tinny
 
Tinny's Avatar
 
Join Date: Apr 2002
Posts: 1,188
So it works ok? You might want to look at the client side too to have it look smoother, the effect code as the projectile traveling is usually done in the client codes that start with fx_.


Redeemed!

An old school mod for jedi academy.
Tinny is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > Arrow trajectory

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:09 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.