Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

How dose one make items or boats float on water?

Share questions and tutorials related to the map editor. Share you maps in the Superfighters Deluxe Custom Maps section.
Forum rules
By using the forum you agree to the following rules.
Post Reply
shawnu4
Meatbag
Posts: 6
Joined: Sat Oct 01, 2016 7:41 am

How dose one make items or boats float on water?

Post by shawnu4 » Thu Nov 03, 2016 11:27 pm

i have no clue help?
0 x

User avatar
TimeWorker
Superfighter
Superfighter
Posts: 196
Joined: Mon Mar 21, 2016 1:57 am
Title: TiME TrAVleR
SFD Alias: ClockWorker
Started SFD: PreAlpha 1.2.1
Location: Time (ofc)
Gender:
Age: 7
Contact:

Post by TimeWorker » Fri Nov 04, 2016 1:41 am

Use invinsible blocks and place them on the water and place item on it then it will look like its floating you know
Z?
0 x
DoNt FoRgEt WhAT TiME It IS!!!![/fade][/color][/shadow]

User avatar
Rubber
Fighter
Fighter
Posts: 26
Joined: Sat May 14, 2016 9:04 pm
Title: Experimental Map Maker...?
SFD Account: Rubbla Bubbla
SFD Alias: @Rubber
Started SFD: First versions of SFD
Location: Italy
Gender:
Age: 23
Contact:

Post by Rubber » Mon Nov 28, 2016 7:46 pm

If you want a boat floating on water, then there are three ways to do it that I know of. Two of them don't require scripting.
Here is a little "drawing" I made to show you the movements the three different methods have.
Image

-1: Use an ElevatorAttachmentJoint along with a few ElevatorPathJoints. (No scripting needed)

Just like this:
Image

This method is the most artificial looking, but it looks good enough in my opinion, and it's the second easiest method to choose.

Here's all the parameters I used:

-ElevatorAttachmentJoint (This ElevatorAttachmentJoint is linked to the the path joint next to it, while the TargetObject is the boat itself)
Image

-ElevatorPathJoint (They both have the same parameters. Make sure to link one Joint to the other)
Image

-2: Use a RevoluteJoint with a little bit of stolen code (Scripting needed)

First of all, let's start with the script itself.
I'm gonna act like a burglar, so I'm gonna steal Gurt's code from Canals to use for our RevoluteJoint.
Here's the code:

Code: Select all

public void BoatBob(TriggerArgs args)
{
	IObjectRevoluteJoint joint = (IObjectRevoluteJoint)(Game.GetObjectsByCustomId("BoatJoint")[0]);	

	if(joint.GetAngle() < -0.1f) joint.SetMotorSpeed(-Math.Abs(joint.GetMotorSpeed()));
	else if(joint.GetAngle() > 0.1f) joint.SetMotorSpeed(Math.Abs(joint.GetMotorSpeed()));
}
You will have to copy this whole code as it is and put it in this section at the top-right of the screen:
Image

After this a window that looks like the one in the picture will appear (It will probably be bigger than mine, but it doesn't matter)
Image
You will have to paste your code in here.

Ok, code aside, here's the boat itself:
Image

Link the RevoluteJoint to the boat just like in the picture then put these parameters...

-TimerTrigger
Image

-RevoluteJoint
Image

After all of this the nicest looking floating is done. If you can't be bothered to make any of these, then here's the easiest one (But it has the worst looks)

-3: Use a simple DistanceJoint (THIS METHOD ONLY WORKS WITH SMALL OBJECTS)

This is truly the laziest one:
Image

Simply enough link the DistanceJoint to the TargetObjectJoint, and link the TargetObjectJoint to our Boat.
Keep in mind that this method only works with small, symmetric objects, so the boat we used until now won't work with this method.
I advise against using this method, but if you want to make loads of boats on the run, then you can use it.

We're done!
I hope you now get how to make an object float on water. If you wanted crates that float on water when you kick them in, you will need a precise script that I won't give you for now (Unless you ask for it, of course)
4 x
Here's what I do:
  • Give bad advice
  • Criticise people's maps in an unnecessary way
  • Spam pictures in tutorials
  • Write walls of text
  • Incoherently open a server
  • Make too complex gamemodes

Post Reply