Jump to content



Photo
- - - - -

Someone working on a primitive Plunger?


  • Please log in to reply
37 replies to this topic

#21 GRONI

GRONI

    Pinball Recreator

  • VIP
  • 1,071 posts
  • Location:Germany

  • Flag: Germany

  • Favorite Pinball: TWD - LOTR - TSPP - POTC - AFM



Posted 06 October 2014 - 02:40 AM

Here is a Table with the Plungers on it. Maybe someone can make this work? It´s far above my scripting knowledge :)

 

If more Plungersteps have to be used, I can make as many as needed.

 

Thanks Guys 

 

Groni

Attached Files


Edited by GRONI, 06 October 2014 - 02:41 AM.

My current VPX Tables I am working on:

 

Attack from Mars/Finished - The Walking Dead Pro/90% - The Lord of the Rings/75% - Family Guy/90% - The Simpsons Pinball Party/15%


#22 javier1515

javier1515

    Pinball Fan

  • VIP
  • 574 posts
  • Location:Villa Maria Cordoba

  • Flag: Argentina

  • Favorite Pinball: The Addams Family, Hook



Posted 06 October 2014 - 03:07 AM

The Plunger looks spectacular. 

have if some guru can make this work ..


"Learning without thought is vain, thought without learning is dangerous." (Confucius)
 
"Aprender sin pensar es inútil, pensar sin aprender es peligroso". (Confucio)

 

 

Please, if you can help me with a small contribution to update my work team and continue to make more tables I will be eternally grateful.
 

#23 dark

dark

    3D model-man

  • VIP
  • 1,936 posts
  • Location:Toronto

  • Flag: Canada

  • Favorite Pinball: Star Wars, AbraCadaBra,MB, LAH,JPark...too many to choose!

Contributor

Posted 06 October 2014 - 03:12 AM

If someone can come up with a formula for this, like for example, 10 positions required for proper function, 10-100% of a desired range say contracts by 30% of total length or just some guide for me to follow that we know will work out I'll gladly make a few variations of 3D plungers for the community.  I just have too much on the go to waste any time on something I'm not sure will work out when so many other things require my attention so I'd appreciate it if there was some guideline to follow.  My hats off to groni for taking the initiative and to whom ever tries to make it work.



#24 Shoopity

Shoopity

    Pinball Fan

  • Members
  • PipPipPipPip
  • 691 posts
  • Location:Colorado

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Contributor

Posted 06 October 2014 - 07:58 PM

Check this out and let me know if this is at all desirable:

 

Attached File  GroniPinball - PrimitivePlunger_mine.vpt   652KB   12 downloads

 

As usual, this is more a proof of concept.  It's timer based, and since I'm not sure how the digital plungers work, I can't say for certain how this would work with that.  I would assume since there's a Plunger.Position method, if you have a digital plunger, it reports back on the digital plunger's position (when I tried reading the number, all I got was 0).  And if that's the case, I think it's easy to convert the raw numbers read from the digital plunger and have that match the distance between the springs.

 

So I exported Groni's mesh, cut out just one 360 degree portion of the spring, scaled it down a bit, and imported that back into VP.  For demo purposes I made 8 meshes.  At this particular scale, they should be 30.5 VP units apart; at different scales, that number would have to be changed and I don't think there's any way to script that since the imported size of the object is unknown to VP.  I put each spring segment into a collection called Springs.

 

You'll notice in the table that at initialization, the script lines up the springs.  For a real plunger, the X and Y settings would have to be swapped throughout the code, but since I had this going sideways (again for demo purposes), movement is along the X axis.

 

When you push the plunger button, it turns on a timer; the entire timer is 11 lines of code, and that includes declaring a Dim, doing a check if the spring is fully compressed, moving the rod, and doing another check to turn off the timer.  It really only takes ~5 lines of code to move all the springs.

 

You can adjust how fast it pulls back by changing PullSpeed

You can adjust how fast it springs back by changing ReturnSpeed

You can just uncheck the Visible option for the rod if you want to see how it looks without it

 

Benefits:

As smooth as can be (currently the timers are set to 10, they could be set to 1 and be even smoother, of course you'd have to adjust the pull/return speeds)

Minimal work for the artist (you don't have to create/export/import as many frames as you want; just create the one spring section)

 

Drawbacks of this:

Each spring segment doesn't "bend" at all (keep in mind, the joint parts will be hidden by the plunger stick); with a real spring, each 360 section goes from a spiral shape to almost a flat circle, that doesn't happen here

Any of the little nuances aren't mimicked that can be done with animating each "frame" (e.g. reflection changes, if the spring rotates at all like Fren mentioned, etc.)

 

I honestly don't think there's any way to 100% do a mesh.  With the mltiple mesh route, I think it might look bad with a digital plunger, or just do a ton of work to create umpteen "frames".  With a mesh manipulation route, you either squish an image or move multiple meshes without doing proper squishing (where squishing is supposed to happen).



#25 zany

zany

    3D Beer Drinker

  • VIP
  • 1,644 posts

  • Flag: Sweden

  • Favorite Pinball: Medieval Madness



Posted 06 October 2014 - 08:18 PM

WOW SHoopity...that's really cool!!! :D



#26 GRONI

GRONI

    Pinball Recreator

  • VIP
  • 1,071 posts
  • Location:Germany

  • Flag: Germany

  • Favorite Pinball: TWD - LOTR - TSPP - POTC - AFM



Posted 09 October 2014 - 04:10 PM

Nice Start.

 

But what I was wondering about...Wouldn´t it be possible to just sync the PrimitivePlunger with JP´s Plunger Script? It works very well and could be used as base. So the P1-P12 Plunger Ramps could be used as invisible objects.

 

So when for example p1 is visible the Prim1 Plunger is visible etc..


My current VPX Tables I am working on:

 

Attack from Mars/Finished - The Walking Dead Pro/90% - The Lord of the Rings/75% - Family Guy/90% - The Simpsons Pinball Party/15%


#27 freneticamnesic

freneticamnesic

    A Faint Ghost Through the Raindrops

  • VIP
  • 3,369 posts
  • Location:Portland, OR

  • Flag: United States of America

  • Favorite Pinball: Star Trek, Black Hole, AFM, Fast Draw, Tron, AMH

  • 360 Gamer Tag: sixgunsounddd

Posted 09 October 2014 - 04:28 PM

You could just use a timer then, right?


You just need the 13 primitives then

if P12.visible = true then prim12.topvisible = true else prim12.topvisible = false


#28 GRONI

GRONI

    Pinball Recreator

  • VIP
  • 1,071 posts
  • Location:Germany

  • Flag: Germany

  • Favorite Pinball: TWD - LOTR - TSPP - POTC - AFM



Posted 09 October 2014 - 04:39 PM

I have 12 Primitives in my demo table you can download in the first post here on the second page.

 

I tried exactly the same script, but the JP Ramps are in an Array. So I tried "Plungers(1)" but it did not work. Also Ramps seems to be not compatible with ".visible" command. JP works with ".alpha =0"


My current VPX Tables I am working on:

 

Attack from Mars/Finished - The Walking Dead Pro/90% - The Lord of the Rings/75% - Family Guy/90% - The Simpsons Pinball Party/15%


#29 sliderpoint

sliderpoint

    Pinball Fan

  • Members
  • PipPipPipPip
  • 760 posts
  • Location:Spokane, WA

  • Flag: United States of America

  • Favorite Pinball: Metallica

Posted 09 October 2014 - 06:23 PM

I have 12 Primitives in my demo table you can download in the first post here on the second page.

 

I tried exactly the same script, but the JP Ramps are in an Array. So I tried "Plungers(1)" but it did not work. Also Ramps seems to be not compatible with ".visible" command. JP works with ".alpha =0"

I believe it is Ramp.isVisible = 0 or 1



#30 Shoopity

Shoopity

    Pinball Fan

  • Members
  • PipPipPipPip
  • 691 posts
  • Location:Colorado

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Contributor

Posted 09 October 2014 - 07:06 PM

OK, I took Koadic's code (which supposedly came from JP's and modified to work with Primitives)

Try this (sorry, I can't upload Groni's table, it's too big for my graciously donated membership):

1) Download Groni's table

2) Add two timers called "PTime" and "PTime2"; Disable both, change both Intervals to something smaller unless you want to see a slow animation

3) Go to Table -> collection Manager -> New - Edit

    A) Name it "CoPlunger"

    B) Add P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, and P12 to it, in that order

4) Select all the Script and replace it with the following:

Option Explicit
Randomize

Sub Table1_KeyDown(ByVal keycode)

	If keycode = PlungerKey Then
		Plunger.PullBack
		Pcount = 0
		PTime.Enabled = 1
		'Plunger.TimerEnabled=0
	End If

	If keycode = LeftFlipperKey Then
		LeftFlipper.RotateToEnd
		PlaySound "FlipperUp",0,1,-0.1,0.25
	End If
    
	If keycode = RightFlipperKey Then
		RightFlipper.RotateToEnd

		PlaySound "FlipperUp",0,1,0.1,0.25
	End If
    
	If keycode = LeftTiltKey Then
		Nudge 90, 2
	End If
    
	If keycode = RightTiltKey Then
		Nudge 270, 2
	End If
    
	If keycode = CenterTiltKey Then
		Nudge 0, 2
	End If
    
End Sub

Sub Table1_KeyUp(ByVal keycode)

	If keycode = PlungerKey Then
		Plunger.Fire
		PTime.Enabled = 0
		Pcount = 0
		PTime2.Enabled = 1
		'Plunger.TimerEnabled=1
	End If
    
	If keycode = LeftFlipperKey Then
		LeftFlipper.RotateToStart
		PlaySound "FlipperDown",0,1,-0.1,0.25
	End If
    
	If keycode = RightFlipperKey Then
		RightFlipper.RotateToStart
        
		PlaySound "FlipperDown",0,1,0.1,0.25
	End If

End Sub

Sub Drain_Hit()
	Drain.DestroyBall
	Plunger.CreateBall
	PlaySound "Plunger",0,1,0,0.25
End Sub

Sub LeftSlingshot_Slingshot()
	PlaySound "Bumper",0,1,-0.15,0.25
End Sub

Sub RightSlingshot_Slingshot()
	PlaySound "Bumper",0,1,0.15,0.25
End Sub

Sub Plunger_Init()
	PlaySound "Plunger",0,0.5,0.5,0.25
	Plunger.CreateBall
End Sub

Sub Table1_Init
	Dim X
	For each X in CoPlunger
		x.TopVisible = 0
	Next
	CoPlunger(0).TopVisible = 1
	ResetPlungers
End Sub

Dim PlNewPos, PlOldPos, PCount
Sub PTime_Timer
	If Pcount <11 Then
		CoPlunger(Pcount).TopVisible = 0
		Pcount = Pcount + 1
		CoPlunger(Pcount).TopVisible = 1
'		PRefresh.state = ABS(PRefresh.state - 1)		Not needed since A) we're not dealing with lights or ramps and 2) this was supposedly fixed in the 9.9 so a refresh light wasn't needed
	End If
End Sub

Sub PTime2_Timer
	Dim X
	Select Case Pcount
		Case 0:ResetPlungers
		Case 1
			For each X in CoPlunger
				x.TopVisible = 0
			Next
			CoPlunger(2).Topvisible = 1
		Case 2
			ResetPlungers
			Me.Enabled = 0
	End Select
	Pcount = Pcount + 1
End Sub

'Sub Plunger_Timer()
'	CoPlunger(PlOldPos).TopVisible = 0
'	PlNewPos = INT(Plunger.Position/2)
'	If PlNewPos > 11 Then PlNewPos = 11
'	CoPlunger(PlNewPos).TopVisible = 1
'	PlOldPos = PlNewPos
'	PRefresh.state = ABS(PRefresh.state - 1)
'End Sub

Sub ResetPlungers
	Dim X
	For x = 0 to 11:CoPlunger(x).TopVisible = 0:Next
	CoPlunger(0).TopVisible = 1
	Pcount = 0
	PlNewPos = 0
	PlOldPos = 0
'	PRefresh.state = ABS(PRefresh.state - 1)
End Sub

I left in a bunch of Koadic's code just in case someone else wanted to play with it.  For example the Plunger_Timer sub just ruins the bounce animation.  Maybe something changed in VP9.9, but anytime I try to get the plunger's position, it's always 0.  I figured that was because that gets fed from a physical plunger.


Edited by Shoopity, 09 October 2014 - 07:09 PM.


#31 freneticamnesic

freneticamnesic

    A Faint Ghost Through the Raindrops

  • VIP
  • 3,369 posts
  • Location:Portland, OR

  • Flag: United States of America

  • Favorite Pinball: Star Trek, Black Hole, AFM, Fast Draw, Tron, AMH

  • 360 Gamer Tag: sixgunsounddd

Posted 09 October 2014 - 07:09 PM

Oh yea that's right... I never had any luck setting the ramps visible and just used a transparent image.

With the timer you wouldn't need to modify JPs script, you can simply add a new timer, enabled=1, interval=0

Sub PrimitivePlunger_Timer()
if P1.alpha = 0 then PrimitivePlunger1.TopVisible = 0 else PrimitivePlunger1.TopVisible = 1
if P2.alpha = 0 then PrimitivePlunger2.TopVisible = 0 else PrimitivePlunger2.TopVisible = 1
if P3.alpha = 0 then PrimitivePlunger3.TopVisible = 0 else PrimitivePlunger3.TopVisible = 1
if P4.alpha = 0 then PrimitivePlunger4.TopVisible = 0 else PrimitivePlunger4.TopVisible = 1
if P5.alpha = 0 then PrimitivePlunger5.TopVisible = 0 else PrimitivePlunger5.TopVisible = 1
if P6.alpha = 0 then PrimitivePlunger6.TopVisible = 0 else PrimitivePlunger6.TopVisible = 1
if P7.alpha = 0 then PrimitivePlunger7.TopVisible = 0 else PrimitivePlunger7.TopVisible = 1
if P8.alpha = 0 then PrimitivePlunger8.TopVisible = 0 else PrimitivePlunger8.TopVisible = 1
if P9.alpha = 0 then PrimitivePlunger9.TopVisible = 0 else PrimitivePlunger9.TopVisible = 1
if P10.alpha = 0 then PrimitivePlunger10.TopVisible = 0 else PrimitivePlunger10.TopVisible = 1
if P11.alpha = 0 then PrimitivePlunger11.TopVisible = 0 else PrimitivePlunger11.TopVisible = 1
if P12.alpha = 0 then PrimitivePlunger12.TopVisible = 0 else PrimitivePlunger12.TopVisible = 1
if P13.alpha = 0 then PrimitivePlunger13.TopVisible = 0 else PrimitivePlunger13.TopVisible = 1
End Sub

this says that when the ramp alpha is 0, then the primitive is not visible, if it's anything but 0, it is visible


and then I'd replace the images of the ramps with a transparent image. that may be a little ghetto but that's how I roll lol



#32 javier1515

javier1515

    Pinball Fan

  • VIP
  • 574 posts
  • Location:Villa Maria Cordoba

  • Flag: Argentina

  • Favorite Pinball: The Addams Family, Hook



Posted 09 October 2014 - 07:15 PM

Work very well, nice job Shoopity  :otvclap:


"Learning without thought is vain, thought without learning is dangerous." (Confucius)
 
"Aprender sin pensar es inútil, pensar sin aprender es peligroso". (Confucio)

 

 

Please, if you can help me with a small contribution to update my work team and continue to make more tables I will be eternally grateful.
 

#33 Shoopity

Shoopity

    Pinball Fan

  • Members
  • PipPipPipPip
  • 691 posts
  • Location:Colorado

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Contributor

Posted 09 October 2014 - 08:02 PM

And, here's an update of my implementation of using multiple spring primitives and squishing them together.  The update includes a tip and more springs.  I also put in a bounce animation (since in a real pull, it goes past the original position, goes backwards again, then eventually rests at the original position).  It's still overly large and horizontal, so you can really see everything.

 

This is heavily commented, so feel free to adjust anything; again, if you want to pull it back (or have it return) slower/faster, just adjust PullSpeed and Returnspeed (say, set them to 0.1 and 0.2 respectively).

 

Attached File  GroniPinball - PrimitivePlunger_mine.vpt   788KB   16 downloads

 



#34 GRONI

GRONI

    Pinball Recreator

  • VIP
  • 1,071 posts
  • Location:Germany

  • Flag: Germany

  • Favorite Pinball: TWD - LOTR - TSPP - POTC - AFM



Posted 09 October 2014 - 09:07 PM

OK, I took Koadic's code (which supposedly came from JP's and modified to work with Primitives)

Try this (sorry, I can't upload Groni's table, it's too big for my graciously donated membership):

1) Download Groni's table

2) Add two timers called "PTime" and "PTime2"; Disable both, change both Intervals to something smaller unless you want to see a slow animation

3) Go to Table -> collection Manager -> New - Edit

    A) Name it "CoPlunger"

    B) Add P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, and P12 to it, in that order

4) Select all the Script and replace it with the following:

Option Explicit
Randomize

Sub Table1_KeyDown(ByVal keycode)

	If keycode = PlungerKey Then
		Plunger.PullBack
		Pcount = 0
		PTime.Enabled = 1
		'Plunger.TimerEnabled=0
	End If

	If keycode = LeftFlipperKey Then
		LeftFlipper.RotateToEnd
		PlaySound "FlipperUp",0,1,-0.1,0.25
	End If
    
	If keycode = RightFlipperKey Then
		RightFlipper.RotateToEnd

		PlaySound "FlipperUp",0,1,0.1,0.25
	End If
    
	If keycode = LeftTiltKey Then
		Nudge 90, 2
	End If
    
	If keycode = RightTiltKey Then
		Nudge 270, 2
	End If
    
	If keycode = CenterTiltKey Then
		Nudge 0, 2
	End If
    
End Sub

Sub Table1_KeyUp(ByVal keycode)

	If keycode = PlungerKey Then
		Plunger.Fire
		PTime.Enabled = 0
		Pcount = 0
		PTime2.Enabled = 1
		'Plunger.TimerEnabled=1
	End If
    
	If keycode = LeftFlipperKey Then
		LeftFlipper.RotateToStart
		PlaySound "FlipperDown",0,1,-0.1,0.25
	End If
    
	If keycode = RightFlipperKey Then
		RightFlipper.RotateToStart
        
		PlaySound "FlipperDown",0,1,0.1,0.25
	End If

End Sub

Sub Drain_Hit()
	Drain.DestroyBall
	Plunger.CreateBall
	PlaySound "Plunger",0,1,0,0.25
End Sub

Sub LeftSlingshot_Slingshot()
	PlaySound "Bumper",0,1,-0.15,0.25
End Sub

Sub RightSlingshot_Slingshot()
	PlaySound "Bumper",0,1,0.15,0.25
End Sub

Sub Plunger_Init()
	PlaySound "Plunger",0,0.5,0.5,0.25
	Plunger.CreateBall
End Sub

Sub Table1_Init
	Dim X
	For each X in CoPlunger
		x.TopVisible = 0
	Next
	CoPlunger(0).TopVisible = 1
	ResetPlungers
End Sub

Dim PlNewPos, PlOldPos, PCount
Sub PTime_Timer
	If Pcount <11 Then
		CoPlunger(Pcount).TopVisible = 0
		Pcount = Pcount + 1
		CoPlunger(Pcount).TopVisible = 1
'		PRefresh.state = ABS(PRefresh.state - 1)		Not needed since A) we're not dealing with lights or ramps and 2) this was supposedly fixed in the 9.9 so a refresh light wasn't needed
	End If
End Sub

Sub PTime2_Timer
	Dim X
	Select Case Pcount
		Case 0:ResetPlungers
		Case 1
			For each X in CoPlunger
				x.TopVisible = 0
			Next
			CoPlunger(2).Topvisible = 1
		Case 2
			ResetPlungers
			Me.Enabled = 0
	End Select
	Pcount = Pcount + 1
End Sub

'Sub Plunger_Timer()
'	CoPlunger(PlOldPos).TopVisible = 0
'	PlNewPos = INT(Plunger.Position/2)
'	If PlNewPos > 11 Then PlNewPos = 11
'	CoPlunger(PlNewPos).TopVisible = 1
'	PlOldPos = PlNewPos
'	PRefresh.state = ABS(PRefresh.state - 1)
'End Sub

Sub ResetPlungers
	Dim X
	For x = 0 to 11:CoPlunger(x).TopVisible = 0:Next
	CoPlunger(0).TopVisible = 1
	Pcount = 0
	PlNewPos = 0
	PlOldPos = 0
'	PRefresh.state = ABS(PRefresh.state - 1)
End Sub

I left in a bunch of Koadic's code just in case someone else wanted to play with it.  For example the Plunger_Timer sub just ruins the bounce animation.  Maybe something changed in VP9.9, but anytime I try to get the plunger's position, it's always 0.  I figured that was because that gets fed from a physical plunger.

That is working very well. And there is a bounce if you set the timers to about 40 you see it. I guess I can live with it like that. Maybe if you want to improve it, I would be very thankful.


My current VPX Tables I am working on:

 

Attack from Mars/Finished - The Walking Dead Pro/90% - The Lord of the Rings/75% - Family Guy/90% - The Simpsons Pinball Party/15%


#35 Shoopity

Shoopity

    Pinball Fan

  • Members
  • PipPipPipPip
  • 691 posts
  • Location:Colorado

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Contributor

Posted 09 October 2014 - 10:09 PM

What kind of improvements are you looking for?  Currently, some things are "hard coded".  E.G. in PTime_Timer, you see the Pcount < 11 means if you added more "frames" (i.e. primitives), you would have to change that 11 to one less than however many frames you have (since an array/collection starts at zero).



#36 GRONI

GRONI

    Pinball Recreator

  • VIP
  • 1,071 posts
  • Location:Germany

  • Flag: Germany

  • Favorite Pinball: TWD - LOTR - TSPP - POTC - AFM



Posted 09 October 2014 - 10:14 PM

Yeah I think I could add some more frames to make it a bit smoother. Anyway, thanks for the code :) That will be thankful added to my current project :)


My current VPX Tables I am working on:

 

Attack from Mars/Finished - The Walking Dead Pro/90% - The Lord of the Rings/75% - Family Guy/90% - The Simpsons Pinball Party/15%


#37 vampirolatino2

vampirolatino2

    Pinball Fan

  • Members
  • PipPipPipPip
  • 1,430 posts

  • Flag: Spain

  • Favorite Pinball: Medieval Madness

Posted 22 March 2015 - 04:21 PM

So.... this is used now on new VP tables?



#38 Shoopity

Shoopity

    Pinball Fan

  • Members
  • PipPipPipPip
  • 691 posts
  • Location:Colorado

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness

Contributor

Posted 27 March 2015 - 09:15 PM

It's all up to authors to use this method or not.  It's freely available to anyone who wants it.