Jump to content

Smooth Entity Motion


Iron1601

Recommended Posts

I've been working on a projectile type entity but I cant get it to move smoothly without extending some other class that adds logic that interferes with what I'm trying to do or straight up breaks everything.

 

I'm trying to simply get it to stop when hitting a wall and to stick to an entity when hitting it and moving with it.

Extending ThrowableEntity makes it break on impact. Extending ArrowEntity forces some methods that are unrelated and causes nullPointerExceptions referring to some data managers. Extending ItemEntity is the closet I've gotten to what I'm trying to do, however continues to slide on the floor.

 

Working around any of these cause it to either stop before hitting the ground, go into blocks, move erratically or rubber-band.

I would imagine some sort of ArrowEntity type thing will work best since it has pretty much all of what I need but extending it causes problems and extending AbstractArrowEntity adds methods and sometimes crashes.

 

Seeing this I tried controlling either the motion or position directly but setPosition every tick makes it jitter and rubberband, setMotion doesn't affect anything directly, from what I've seen, and instead has to go through super.tick() (for ProjectileEntity) or move() (which forces it into the ground sometimes).

 

I would appreciate any help especially regarding the correct way to do this, since seemingly every Entity class has a different way of doing it, sometimes using privated fields or methods which are no fun.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.