# [Joints] Crazy Snake instead of my lamp

Discussion and feedback on Construct 2

### » Mon Nov 23, 2015 12:49 pm

Hello everyone,

I'm here because of my snake which is a lamp. I mean, it supposed to be a lamp, so 3 rectangles and 1 triangle with some pivot joints for hold them together. But I certainly missed a step, and now the thing is on the ground with horrific spasms, like a demonic snake which tries to reach a yoghurt river or whatever.

To be precise, here's a small drawing and the action related to it. As you may understand, a rectangle is a link, so several rectangles connected will be a string. But look at these two rectangles with two image point, I make the joint by connecting their image points...isn't that how we're supposed to do it ? What's wrong exactly ?
B
5
Posts: 20
Reputation: 269

### » Wed Nov 25, 2015 3:30 pm

Guys ? Someone ? Okay I was maybe too specific, in brief, how can I make a realistic string by using joints and physic objects ?

I can join the capx of my previous attempt if you need it (the one with the crazy shit on the ground, be careful I bet this thing want to eat your head or something). I just want to build a physical lamp hanging from the ceiling which reacts well realisticly with another physical object (like my sprite or a rock or I don't know, your favorite duck for instance). You know, this kind of stuff :

The way I see it, it's a movable object (the lamp itself) related to an immovable object (the ceiling) thanks to a pivot joint (the cable). Am I wrong ? If I'm not, why are all my attempts "alive" and "hyperactive" as soon as I define the corresponding joint ? Thanks in advance
B
5
Posts: 20
Reputation: 269

### » Fri Nov 27, 2015 5:49 pm

Nobody use Chipmunk physic here ? :/
B
5
Posts: 20
Reputation: 269

### » Fri Nov 27, 2015 6:04 pm

You need to disable the collisions between the objects I think. The simplest way to do that is to make there collision group 1.
B
98
S
36
G
131
Posts: 5,521
Reputation: 83,505

### » Fri Nov 27, 2015 6:40 pm

Okay this was clever, I wasn't. Indeed, it works ! But the thing still swinging now, like if someone just gave it a little push. Is there a way to make it immobile at the beginning ? Thanks for your answer anyway, it really helped me, as easy as it was x)
B
5
Posts: 20
Reputation: 269

### » Fri Nov 27, 2015 7:01 pm

Here's a few ways to make a single-segment rope joint:

https://dl.dropboxusercontent.com/u/523 ... oints.capx

I think the slide joint with some kind of rotation damping on the lamp would be my preference - it give you an elastic cable, a bit more interesting than the stiff pivot joint.
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

### » Fri Nov 27, 2015 7:20 pm

It shouldn't swing if everything is centered around the fixed joint.

Here's an example of one way to do it:
https://dl.dropboxusercontent.com/u/542 ... _lamp.capx
B
98
S
36
G
131
Posts: 5,521
Reputation: 83,505

### » Sat Nov 28, 2015 10:38 am

Thanks, they are perfect (both of your examples). Just a last thing about yours, R0j0hound. I noticed that your solution results sometimes by a Javascript error "the body is undefined". It's not a real problem because it doesn't concern the place I need to put this lampe, but I still can't figure out why it happens. Any idea ?
B
5
Posts: 20
Reputation: 269

### » Sat Nov 28, 2015 12:27 pm

You mean my example causes that error? Or in your capx?
B
98
S
36
G
131
Posts: 5,521
Reputation: 83,505

### » Sat Nov 28, 2015 4:16 pm

In my capx when I use the same technique than in your example

I don't really understand why. It says "the body is undefined" as soon as I use a background (Tile map or Sprite).

I tried on the same layout then in another one (wire and lampe on layout A, Background on layout B), the error still occurs
B
5
Posts: 20
Reputation: 269

Next