Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits)

Hello Ariyo,

I'd like to help you if it's possible. 

Can you explain something more about what kind of problem are you having?

Have you tried to communicate with the Photon addon developers first?

Then, while not being able to run your code, I've read it and I've noticed a few things that you may check.


1. StartGrapple(). Adding a new component not only with every click but continuously.

Check this line:

 joint = player.gameObject.AddComponent<SpringJoint>();

You're calling StartGrapple in every frame while your mouse button is down. 

I suspect that you're not controlling that your player will have only one joint component active at the moment and that you're creating and adding multiple SpringJoint components to your player. Non stop. Possibly, you may need to control that and allow only one joint at one moment.


2. StopGrapple(). Destroying a joint without disconnecting,

Here I have not so much experience and I may be wrong, but I think that the connected objects to the joint may be looked after before destroying the link/joint. ("looked after before destroying", english is so funny sometimes...) Not sure here, but destroying the joint without looking may give wonky results in the physics system.

What about just disconnecting and reconnecting instead of destroying and creating SpringJoint components? Maybe that could help.


3. Try to keep your code clean the best you can.

I know it's only one, but you left this little guy...

    private Vector3 currentGrapplePosition;

... lonely and abandoned between methods, being bullied down the alley, while you have all your other variables on the top of the page, what is a good thing, but not for the little guy.

Sorry for not being able to help you more at the moment.

Good luck!

Hey synced the line renderer but giving error line renderer out of bounds when processing it in Rpc_DrawRope method

Hi,

I've noticed that you define how many points the LineRenderer will use when you click (inside StartGrapple())

 lr.positionCount = 2;

But...

I'm not sure if this

if (!joint) return;

is really stopping the method if the joint is not existing yet. 

I prefer to use something like:

if (joint == null) return;

Or at least, I'm more used to that expression to control if something exists.

Then, if I'm correct, it's possible that the LineRenderer is trying to draw points before the number of points has been defined (RPC_DrawRope is being called every frame in LateUpdate) 

I mean, maybe I'm wrong, but it's possible that you are asking to draw the LineRenderer second position and it's possible that LineRenderer still doesn't know how many points it has to draw.

What about trying to setup the LineRenderer in the Awake method? Awake is launched before Updates. 

Again, trying to help here, but I'm unable to run your code and I'm debugging just with my eyes :(

Good luck!