Ninja Rope

Blitz3D Forums/Blitz3D Beginners Area/Ninja Rope

cermit(Posted 2003) [#1]
Has anyone already done a ninja rope for the player
like in worms or Liero? Just some physics or something
that it doesnt look crapy with like one kind of constant speed...


jhocking(Posted 2003) [#2]
Please be more specific than "ninja rope." What does that mean?


soja(Posted 2003) [#3]
You'd know right away if you've ever played Worms.

Just imagine shooting a grappling hook somewhere and then swinging from it. He wants pendulum physics.


sswift(Posted 2003) [#4]
He wants to be able to fire a rope, which latches onto a surface, and allows you to pull in slack or let ot slack as you swing. And of course, he wants you to accelerate as you swing.

You get the acceleration from swinging from gravity. Gravity pulls you downward, and you fall faster and faster.

But the rope constrains you. It keeps you a certain distance from the point at which it's attached.

And of course you need momentum. Gravity doesn't just pull you down at a constant speed, it increases your speed by X amount each frame.

Unfortunately I never wrote any physics which works with stick constraints like this so I can't help ya out more than that. Look up "stick constraint" on google or gamasutra and you might find what you need.


Rob Farley(Posted 2003) [#5]
Here's a complete cheat to get you started:

Graphics3D 640,480

camera=CreateCamera()
MoveEntity camera,0,0,-50

light=CreateLight(2)
PositionEntity light,1000,1000,-100

rope_top=CreateSphere(6)
EntityColor rope_top,255,255,0
PositionEntity rope_top,0,20,0
rope_end=CreateSphere(6)
EntityColor rope_end,255,0,0
PositionEntity rope_end,0,-10,0

swing=0

rope_length=20

Repeat

	PointEntity rope_end,rope_top
	MoveEntity rope_end,0,0,EntityDistance(rope_end,rope_top)-rope_length
	TranslateEntity rope_end,Sin(swing),-.1,0
	swing=swing+1
	

UpdateWorld
RenderWorld

Flip

Until KeyHit(1)



Wiebo(Posted 2003) [#6]
If it's 2d you're after, go here:
http://www.blitzbasic.com/Community/posts.php?topic=21802


Paradox7(Posted 2003) [#7]
"Ninja Rope" .. I just love the sound of that :D


Neo Genesis10(Posted 2003) [#8]
Anyone who has truly played worms would also know that the ninja rope wraps around the terrain. Perhaps thats what he's really after.


cermit(Posted 2003) [#9]
Thanks, this was the code I was looking for.
Ninja rope for B2D and 3D, this is great! =)


meemoe_uk(Posted 2003) [#10]
Duh at 2003-11-14 14:17:29 half the posts for this topic are missing....


Genexi2(Posted 2003) [#11]
>> which latches onto a surface, and allows you to pull in slack or let ot slack as you swing. An

You forgot to mention "that also bends around the terrain".....I wonder how the hell the guys at Team17 did the math for all that in Worms....
(too bad the NinjaRope in the Worms3d demo {you had to hack the config files to access it} if all fugged up, hope they fix it in the full thing)

Heck....so many freakin games in Worms have been created which mostly involve movement by NinjaRopes....and its fun as hell as well.....

Anyway, I could make a rope thing like Dr.Av did there in 2d, only problem would be the collisions though....
(havin the rope bend around the terrain and etc...)


cermit(Posted 2003) [#12]
More help would be even better than greate so
if you have any code (with or without collision)
just post it =)


Buggy(Posted 2007) [#13]
I would also like to achieve this affect. In 3D, would it be possible to locate the area of the rope that collided with the terrain, and somehow adjust mesh at that point so it "wraps" around the terrain?

I know it's a bad picture, but to give you an idea:


Also, I don't know if a mesh deformation like this would mess up the texturing of the rope or not.

Any advice much appreciated.


AJirenius(Posted 2007) [#14]
In this case I would probably buildup a rope of small points/polys, where every point checks for collision of world and then in the end draw a rope between the points as they wind up.

make sense? probably not at this time...


Buggy(Posted 2007) [#15]
It makes sense, but wouldn't all of those collision checks take up a lot of time? Could you just do one check and find the point of collision? I don't know... I'm terrible with 3D stuff.

Edit: Without looking at it, what about the Joints code in the Blitz3D samples?