Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17075

Physics collision problem

$
0
0

@jvfiel wrote:

My laser

basicProjectile->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT);
	basicProjectile->setRotation(weaponBody->getRotation());

		x_final = player->getPositionX() + winSize.width*0.275;
		y_final = player->getPositionY() + winSize.height*0.275;

		x_limit = Vec2(x_final, y_final);

		basicProjectile->setPosition(newPoint);
		scaleAmmo = basicProjectile->getContentSize().width / basicProjectile->getPosition().getDistance(x_limit);
		basicProjectile->setScaleX(1.0f / scaleAmmo);
		basicProjectile->setRotation(weaponBody->getRotation());
		scaling = Sequence::create(
			ScaleTo::create(0.1f, (1.0f / scaleAmmo), basicProjectile->getScaleY()*0.1),
			nullptr);
		scaling->setTag(1);
		basicProjectile->runAction(scaling); //stretches the laser

on my physics collision

bodyA->getNode()->stopActionByTag(1); //stops the stretching of laser

 laserEffects(bodyB->getNode(), bodyB->getNode()->getPosition()); // currently creates/spawns the effect at the anchor point of bodyB which is the tile shown at the picture.

Now I want to spawn it where the laser has stop stretching.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17075

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>