Best way to display projectile path

Blitz3D Forums/Blitz3D Programming/Best way to display projectile path

RifRaf(Posted 2010) [#1]
Hi,

I'm tinkering with Tiny Tanks again and am wanting to display an arching projectiles path to make 3rd person view aiming easier than it currently is. However my projectiles arent on typical arching maths.

Here is how my projectile is created
pr\generaltimer#=gametimer#+10000   		;timer for mortar blast will self terminate after 10 seconds
pr\gravity=gravity*4                        ;its mass is 10 times more than "normal"
pr\velocity=5.65 
pr\mesh=CopyEntity(projectilemesh(1))
attachdxlight(pr\mesh,255,100,0,6)
EntityColor pr\mesh,10,10,10
PositionEntity pr\mesh,px,py,pz             ;initial position


and here is how it is updated
For Pr.projectile=Each projectile
    Cc=CountCollisions(pr\mesh)
	Select pr\weaponid
	Case 0 ; mortar
    	pr\velocity=pr\velocity*.975 ;reduce velocity for resitances
    	pr\gravity=pr\gravity*1.005  ;increase gravity to give that volley effect
        If pr\gravity#<-2 Then pr\gravity=-2 ;put a cap on gravity/mass

        ;move the projectile mesh forward
        MoveEntity pr\mesh,0,0,Pr\Velocity*delta_timescale
        ;have gravity pull on it as well
    	TranslateEntity pr\mesh,0,pr\gravity*delta_timescale,0


currently there is no aiming assistance , as shown here


and im trying to get an aiming guide like this mockup.


any suggestions welcome. thanks

Last edited 2010


_Skully(Posted 2010) [#2]
I see you have some timing control in there but its not across the board (velocity and gravity are free to apply full effect)

One way...
You should be able to "project ahead" and place a ghosted view of the projectile every "so many" game ticks, or just continue iteratively until you hit ground. You could even have it build slowly but stay accurate. Make it so that if the player removes his finger off the "targeting" button, the path quickly fade away or something. It would then start over next press.


RifRaf(Posted 2010) [#3]
Thanks, I was considering something like that, but since it will be a real time guide I would have to complete the path once per game loop. I could just accelerate the path by a given increment i suppose. Just use the same increment on the applied gravity and velocity for the testing path


RifRaf(Posted 2010) [#4]
I went with this in the update loop for weapons that dont shoot in a straight line.

Select home\primaryweapon
Case 0 ;mortar
        Assist_Needed=1
	test_gravity#=(gravity*4)
	test_velocity#=5.65
    	PositionEntity projectilepivot,EntityX(home\gunexit,1),EntityY(home\gunexit,1),EntityZ(home\gunexit,1)
        RotateEntity projectilepivot,EntityPitch(home\gunexit,1),EntityYaw(home\gunexit,1),EntityRoll(home\gunexit,1)  
    	;do a max of 30 assist points
        cube=0
	For i=1 To 300
           If test_gravity<-2 Then test_gravity=-2
	   MoveEntity projectilepivot,0,0,test_Velocity
	   TranslateEntity projectilepivot,0,test_gravity,0
     	   test_velocity=test_velocity*(.975)
    	   test_gravity=test_gravity*  (1.005)
           If i Mod 10 = 0 Or i=5 Then
           cube=cube+1
           ShowEntity aim_Assist(cube)
           PositionEntity aim_assist(cube),EntityX(projectilepivot),EntityY(projectilepivot),EntityZ(projectilepivot)
           If cube>1 Then PointEntity aim_assist(cube),aim_assist(cube-1) 
           EndIf
       Next
       PointEntity aim_assist(1),aim_assist(2) 
       For ii=cube+1 To 30
	 HideEntity aim_assist(ii)
       Next



results are below, i think they look good enough , havent tested if this
has any fps hits to the game, I rendertween so its not obvious yet, ill
have to load up fraps to get actual fps with the aim assist on and off.




thanks for the suggestion.

Last edited 2010


D4NM4N(Posted 2010) [#5]
they would look better as fullbright white or yellow and half alpha flat rectangles rather than blocks.


RifRaf(Posted 2010) [#6]
I agree, after my testing I polished them up a tad. see my earlier post here for a shot of them with FE_BLENDX4. However I like the 3D shape of the segments, but I may create a different type of shape later

http://www.blitzbasic.com/Community/posts.php?topic=92593

Last edited 2010