hi i am learning and try to understand multipong, now i am stuck with collision, i want to make collision with the wall, anyone can help??

hi fendi,

multipong uses the Intersect (3D Quad Line) node to determine collision with the paddles. it ‘casts a ray’ (i.e. transforms the intersection line) from the ball in the direction it is travelling, and if it intersects a quad (which are not visible, but always positioned at the same spot as the paddles) and the intersection is close enough, it will make the the ball reflect from the paddle.

creating collisions with the wall is simpler, because the ‘wall’ ist just the circular space around the playing field. you could just check wether the ball is a certain distance away from the center (the Polar (3D) node is nice for this). the math for a proper reflection (correct angles and all) can be figured out by using mighty trigonometry! i think i included an example image of the vector ‘math’ in the collision subpatch at the time …

best luck

hi diki,

i am currently still trying to understand by modify yours, now in collision patch i changed the ‘collision quad transform’ node to ‘segment’ node which i made in display routine patch. i am wondering that did i do the right way? and i also attach the vvvv patch. can u help me to have more understanding… thanks

MultiPong - 3.rar (54.8 kB)

hi diki i had changed by adding new patch for display segment now, by doing this i already get the collision but it doesnt work for the reflection, i attach the new multipong patches here. can u explain more in reflection patch pls… thanks

OriginalMultipong.rar (48.3 kB)

hi fendi,
i have to admit that i don’t recall all the details of this messy patch … maybe it is even easier for you to build your own.

two things about your changes:

you should take a look at the helpfile for the Intersect (3D Quad Line) node; it is important to note that it uses the incoming transformation to transform a quad (which is then checked for intersection). you give it the transformation of the segment, but the transformation does not contain any information about that - it acts like there is a quad in the middle of the screen, facing the viewer. this is why the collision acts strange.

it is also not such a good idea to use the intersection for collision with a sphere, when there is only one and it is centered at 0,0 - because you can more easily compare the distance of the ball to 0,0 and trigger a collision when necessary. i’m sorry, but i don’t know how to implement this behavior into the multipong patch - it is rather old and messy. i really believe you can do better by looking at the helppatches and building your own - because it will result in a patch that you understand. right now, we would both have to figure out how to properly work with multipong ;)

best luck, diki

Hi diki,

i am now trying to make my own, but here seem like the intersect doesnt work, can u check why? btw sorry for ask you a fever for this again. and one more thing, why we need to use rotate node to line intersection? i attach my work.

sorry separate post

NewMultipong.rar (123.2 kB)

hi diki, i just tried again and i put rotate node. it can work for the intersection, but still weird, can u explain why? thanks and i attach my new patch.

NewMultipong.rar (123.2 kB)

hi fendi,
you need to put a rotation on the line transform because, by default, the intersection line points along the x-axis (to the right) and not along the z-axis (into the monitor) as expected by intuition. i made a small patch explaining it; i hope it helps.

i think it is also important to know that the quads i used for the visible paddles in my multipong are not the same quads that are used for intersection! i use the visible quads’ transformations, but add a rotation to them (if they were visible, they would be a thin line because they are ‘standing on their edge’).

intersect_explain.v4p (22.4 kB)

hi diki,

that means, we can use quad (as the paddle) without put rotation because we already put rotation in intersection transform for the ball. but if i dont put the rotation, intersect doesnt work.

i check the movement of the ball and the quad, looks weird seem like the ball and the paddle are defferent dimension and never intersect each other. can tell me how to fix it. i attach the latest patch… really thanks

NewMultipong.rar (127.0 kB)

hi diki, for the reflection part based on your multipong, is it possible to reflect the ball by calculate the velocity vector. so when the ball get collision, it will reflected to proper vector by calculate the velocity vector? (without get effected from paddle rotation). how to implement it? because i changed the calculation, seems like just effect to the speed of the ball. thankss

hi fendi,
i don’t know what you are talking about exactly, but i am sure that it can be done in vvvv. the wikipage on 3d Vector Mathematics should contain all the info you need for your calculations.

hi diki,

i mean for wall reflection, i am using square wall, do i need to define all the wall (upper wall, below wall, left wall and right wall) one by one then calculate with velocity vector of the ball. or just calculate from original velocity vector of the ball to get proper reflection when it get collision. i attach my pong patch. i need your guide to put reflection. thanksss

NewMultipong.rar (597.6 kB)

i’m sorry, but i don’t understand what you mean exactly. your patch is very complex, and i can’t figure out what appears to be the problem. i advise you to google for ‘reflection vector’ to understand the math behind the problem, and to build a small patch that solves only that. this will make it easier for you to debug & build a module to use in your patch.